Question

So in one of my pages of my app I have a UIWebView setup, along with navigation buttons to go back, and forward between history. Well I wanted to enable and disable those buttons when the UIWebView couldn't go back or forward, so I used this:

- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    if (webView.canGoBack) {
        [_backButton setEnabled:YES];
    } else {
        [_backButton setEnabled:NO];
    }

    if (webView.canGoForward) {
        [_forwardButton setEnabled:YES];
    } else {
        [_forwardButton setEnabled:NO];
    }

    return YES;

}

This works just fine on the iPhone side but not on the iPad, on the iPhone when the UIWebView cannot go back or forward it disables the icon or button. On the iPad they are always enabled. The buttons are both on a navigation bar, exactly the same, both use the same viewcontroller.h and viewcontroller.m and the buttons I just matched exactly the same to the same file owners.

Does anyone know how to fix this? Its really starting to get on my nerves and I dont understand why it works on one and not the other. Thanks in advance.

Was it helpful?

Solution

Feeling pretty stupid for this and glad I didn't waste one of my support tickets on this. I forgot inside the iPad story board to apply the UIWebView I was using to a delegate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top