Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Back and Forward button on UIToolBar in UIWebview

i am new to iphone. i want to disable Back(left arrow button) and Forward(right arrow button) button on UIToolBar in UIWebView. After moved web page want enable back button and then Forward button want to enable when its need. in my app, i am using toolbar at bottom side via interface builder. please any one help me!

like image 542
Sivanathan Avatar asked Feb 23 '10 11:02

Sivanathan


1 Answers

Send the following message to the button object to enable/disable:

// Enable 
[myButton setEnabled:YES];

// Disable
[myButton setEnabled:NO];

To determine whether you should show these buttons you should check the following properties on the webview:

[myWebView canGoBack];
[myWebView canGoForward];

You'll want to check these whenever the user loads a page. To do so implement the UIWebViewDelegate method webViewDidFinishLoad:

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
  // Enable or disable back
  [myBackButton setEnabled:[myWebView canGoBack]];

  // Enable or disable forward
  [myForwardButton setEnabled:[myWebView canGoForward]];

 }
like image 186
pheelicks Avatar answered Sep 20 '22 06:09

pheelicks