简体   繁体   中英

UIWebView doesn't update

I am using UIWebView loadRequest to request a new URL. The UIWebView is inside a TabBar View. When I place the request inside awakeFromNib it works. When a make a subsequent call the view does not change.

[webDisplay loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];

If I place the initial request inside viewDidLoad instead of awakeFromNib it also doesn't seem to work.

I note that if I track request by delegating shouldStartLoadWithRequest this method also doesn't seem to be called by this loadRequest call.

Tabbar view controllers are loaded only once ie when a particular tab is selected for the first time. So, viewDidLoad and awakeFromNib are only called once.

You need to call loadrequest in viewDidAppear method for the webview to be reloaded with latest content whenever that particular tab is selected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM