I am trying to make a back button in my navigation bar because i already have a tab bar at the bottom of the screen.
my layout is this:
tab bar[
navigation bar {
webview ()
}
]
essentially. i need to programmatically add a back button and cannot seem to figure out how. i know that there is a goBack method but am not very familiar with how to implement this.
I already have a button which pulls up ana action sheet with several options but how would i go about having that use the goBack method?
as I understand I can also use something like
if (mywebview canGoBack) {
[mywebview goBack]
}
but I'm not sure how to make an action sheet button do this.
any help?
A view that embeds web content in your app.
Apple is phasing out UIWebView, which is used by developers for integrating web content into an app in a quick and secure manner. Apple is replacing UIWebView (and WebView) with WKWebView, an updated version, as UIWebView has been deprecated.
Unlike UIWebView, which does not support server authentication challenges, WKWebView does. In practical terms, this means that when using WKWebView, you can enter site credentials for password-protected websites.
Somewhere in your action sheet's delegate file, you should have a method similar to this:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) { // if the first option is selected, whatever it may be... (counting starts at zero))
if ([myWebView canGoBack]) {
[myWebView goBack];
}
}
else return;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With