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 .
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.
精彩评论