Rishabh
Rishabh

Reputation: 3852

Reloading a frame

I am creating a class UIView which has a frame which loads a webview in it. When I click the link in the webview it opens up another webview with a back button . i would like to how can I make the back button event to reload the UIview .

Upvotes: 0

Views: 138

Answers (1)

audience
audience

Reputation: 2412

You don't have to use 2 UIWebView. The easiest way to implement a back button like in safari and other apps is to implement the UIWebViewDelegate Method. Inside this method you set the enabled property of your button to the canGoBack property of the web view.

- (void)webViewDidFinishLoad:(UIWebView *)webView {
     backButton.enabled = webView.canGoBack;
}

When the web view stops loading the new website, the button gets enabled.

Another interessting property of the UIWebView is canGoForward for the forward button.

See the UIWebView Class Reference for more details.

Upvotes: 1

Related Questions