开发者

UIWebView doesn't update

开发者 https://www.devze.com 2023-01-19 21:37 出处:网络
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开发者_StackOverfl

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开发者_StackOverflow社区 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 i.e 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.

0

精彩评论

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

关注公众号