iphone - Back button in an app without view controller - iphone

I'm completely new to iphone apps. I'm creating an iphone app that is designed in HTML and jquery with phonegap. I want to include a back button on the top like the default one in the iphone. I searched on net but all i found, required view controllers.I don't have multiple views so how can i include a back button on my app. Step by step explanation would be very helpful.
Thanks in advance..:)

Why would you include a "back" button if you don't have multiple views? What exactly will you navigate "back" to?
"The net" is correct, you need a UINavigationController to house a "back" button which would pop a view to the previous view.
Other than a UINavigationController, you could use a UIToolbar and set a button to the left hand corner and give it the title of "Back" to simulate the native appearance — but this would be misleading and pointless.
I don't use PhoneGap, but I am sure there is a way to simulate a NavigationController and manually place a button there. I'm also sure it won't be shaped like a back button either (with the pointy end).
javascript:history.go(-1)

UINavigationController is a native control which is in iOS frameworks. As you are using HTML, jQueryMobile and phonegap you should not be looking at those controls. You should totally work in your HTML pages and CSS for that purpose.
The below page contains that back button in jquery mobile. You should be implementing this in your html page.
http://jquerymobile.com/test/docs/toolbars/docs-headers.html

Related

Tab Bar with popup buttons iPhone

I want to have this type of bar at the bottom of the application and whenever a button is clicked new buttons should popup, which one of them when clicked should take me to its connected view
You shouldn't use Popup as control, I'll recommend you to use it like a notification as this is not Apple way of showing controls.
Here is a nice link from boctor iDev recipes.
You can find here custom UITabBar as well Notification
I would suggest you not to try customizing UITabbar. This will go against the normal behavior of UITabbar and Apple may reject your app for tampering with normal behavior.
You can try having a UIView with a set of buttons in them and bring the similar functionality as in your image.

iOS Bubble Popup Menu similar to ITunes

Could anyone provide some guidance on how to implement that speech-bubble like popup menu when you click "More" in the IPhone IPod application toolbar?
I think you are looking for UIPopoverController. Popover controllers are just containers for view controllers: write a view controller that does what you want, and you're set. But this is for iPad. If you want this for iPhone, then read on. I have put up some solutions.
You could even explore UIActionSheet but UIPopOverController gives more flexibility.
I believe you are talking about something like this ?
Here are some solutions you could adopt -
Forgot that you wanted this for iPhone, Have a look at the iPhone UIPopoverController implementation: WEPopover
On iPhone you would generally use a UIActionSheet for a stack of buttons like that. It slides up from the bottom, rather than popping up next to the button, but that's the standard behavior on iPhone.
Or you could manually instantiate a UIView using a custom background image or drawing with transparency, add some UIButtons (or other type of custom view) on top, and also somehow handle all touches outside that view.
Note that is is non-standard UI. An actionsheet would be more HIG compliant.

Add an animated top bar to UIWebView

I have a UIWebView controller that loads a web page and I would like to add some kind of a bar at the top of the page with refresh and close buttons.
The bar should hide when the page loaded and should show again if the user taps the top part of the page.
Does anyone know how to approach it? Is there any simple way to do that?
UPDATE:
I think I wasn't clear enough with the question, so here are some clarifications:
1. The applications is a standard application that one of the flows opens UIWebView that loads a web page
2. What I'm looking for is a bar that will slide down on top of the web page (loaded in UIWebView) and should help the user overcome a scenario where the web page is not loaded for some reason
3. The bar should hold the back (just close the UIWebView) and refresh (reload UIWebView) operations.
Hope it helped.
Thanks,
Shimix
I'm working on something like this right now and so far, here's what I've come up with. Some of this may be obvious, but important:
Your address bar should be the left navigationItem.
The search bar is the rign navigationItem.
You should animate a cancel button in/out when beginning/ending editing in the URL box.
Safari Mobile uses the Prompt property of the navigationBar to display webpage titles.
To animate the widths of the search/URL bars, use UIView animation when the bar is selected.
It's pretty simple to add a UIToolbar above the webview with UIBarButtonItems that call the webview's refresh, back, and forward methods. You can also add the webviewdelegate methods to your view controller to detect when the page has finished loading and hide/show the toolbar that way.
If you want the refresh and navigation controls to be displayed as part of the html content of the webview itself, that's a littler tricker, but not impossible. You can use the webview's shouldLoadRequest delegate method to detect that those buttons have been tapped, and then take the appropriate action within your viewcontroller. Hiding and showing the nav bar would have to be handled in javascript.
Unless I'm missing a library/project doing this, I don't think there is a simple way to do this.
I have already coded something similar to Safari mobile address bar, and from memory, it involved using private apis and/or playing with the "not so private but use at your own risks" UIWebView subviews hierarchy...

problem with iOS 4.2 when user press the list view item to go to UIwebview page and the navigation button disappears on the second visit

My app is a Navigation based application. The main menu contains the list view items. if I clicks one of them, it goes to next view which in this case take me to UIwebview embedded web site. Everything is looking great. I can view the content of web page, the navigation control back button which takes to the main menu if I press it. However, I'm having issue when I try to go back to main menu if i visit that subview the second time. It loads the content of UIwebview web page, but the navigation button is gone and won't let me go back to main menu. This problem only appears on latest iOS 4.2 version. Otherwise it works great on 3.1 to 4.1. I would appreciate any hints or inputs.
Note this seems not working for subview using UIWebview embedded web content. I don't have any issue with other subviews
Can you show us the code ? Did you try this: self.navigationItem.hidesBackButton = NO; in viewDidLoad method where you are adding UIWebView to your view..

iPhone + navigate to back screen programmatically

I am developing a application in which I need to provide navigate to backward screen programmatically, in which there are two scenarios:
There will one MainWindow.xib and few buttons on it, click of any one button will load another appropriate screen. On this screen, I need to put back button, click of which will load MainWindow.xib again and user can choose some other option.
Except the above scenario, also all the screens will contain back button, click of which will load the previous again and user can choose some other option.
Regards,
Pratik
You want to use the UINavigationController for this. See the link for the documentation and example projects. I can't really give a full example here, but you can get started with the "Navigation-Based Application" template in XCode.
The general idea is that you push and pop views to/from a UINavigationController, and it will handle the back button and navigation toolbar for you. It's pretty straight forward.