Simple concept, however it's not working. I have two buttons in my UIWebView
, a back button, and a forward button. Back buttons calls [self.webView goBack] and forward [self.webView goForward].
Now I want to know basically if the UIWebView
can go back. If so, then enable the back button, and let it go back, and the same for the forward button.
-(void)webViewDidStartLoad:(UIWebView *)webView
{
if([self.webView canGoForward]) {
[forwardArrowBtn setEnabled:YES];
} else {
[forwardArrowBtn setEnabled:NO];
}
if([self.webView canGoBack]) {
[backArrowBtn setEnabled:YES];
} else {
[backArrowBtn setEnabled:NO];
}
}
Problem is this doesn't work on the first load. For example: I click on a link within the UIWebView
, it goes to the page, but the back button is still disabled and not clickable. Not until I click on another link will the back button show enabled and start working.
How come this doesn't work the first time you go to a different page, and only works the second time?