can i use the back button in first responder iphone xcode?
When I click the first responder in the xib, the inspector shows several thi开发者_运维百科ngs, such as go back, reload, and other outputs that look like they can be connected to the webview.
i didnt create any of the 'received actions' listed there.
can i use the 'goBack' action and connect it to a button to go back? or do i have to make my own IBaction and connect that to the button?
I believe you would have to create an IBAction for the back button in the view you are placing it in. I do however recommend switching views using the modalTransitionStyle. It is much easier to implement and not as confusing in the Interface builder.
If you still want to use this Navigation concept, the back button would be something like this. Drag in a toolbar with the "Item" button on the left hand side to the top of the view you want. Rename "Item" to "Back"
In your header you would have:
- (IBAction)whateverYouWant:(id)sender;
And in your main:
- (IBAction)whateverYouWant:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
This however is when you have two views only, and are using modalViewController, which I recommend.
This tutorial should help: http://www.youtube.com/user/antman872?blend=1&ob=5#p/search/0/zzay_bHVBS0
Hope that helps
That's for a UIWebView
, as you said, and not for working with UIViewControllers
or UIViews
. Yes, I would create your own IBAction
, link that to a button, and then in the .m file, call dismissModalViewControllerAnimated:BOOL
.
精彩评论