开发者

Reloading a frame

开发者 https://www.devze.com 2023-03-18 19:10 出处:网络
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 c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号