views:

47

answers:

2

I have two views controlled by a uinavigationcontroller. the first view has a UIWebView and has button that takes the user to the second view. The user can get back to the first view by tapping the back button on the nav bar. however the webview's content is not current. How can I refresh the content in the first view's webview when coming back from the second view?

+1  A: 

In the view controller for the WebView do the following:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear: animated];

    [webView reload];
}
Max Seelemann
how can I skip [webView reload] the first time opening the app?
Yazzmi
The animated flag should be NO then...
Max Seelemann
+1  A: 

In the first view controller:

- (void)viewWillAppear:(BOOL)animated {
    [myWebView reload];
    [super viewWillAppear:animated];
}
jtbandes