Reputation: 12262
i am having a UIWebView showing and HTML page that has some checkboxes, radio buttons. My Application has tabbar controller that switches b/w two controllers. How i can maintain the current state of UIWebView. ( e.g. i have selected a checkbox and i change the tab and go to other ViewController and again come back to UIWebView. the WebView resets itself and goes to the start... i want to maintain the state of UIWebView ( all the checkboxes clicked) .. how i will do that ??
any idea ??
thanks in advance
Upvotes: 0
Views: 1075
Reputation: 17918
It sounds like you're loading your web view in viewDidAppear:, or some other method that gets called each time you switch to the tab. If you load your web view in viewDidLoad:, it will only get loaded once, and will retain its state when you switch tabs.
EDIT: When I wrote this answer back in 2009, I apparently didn't understand the view controller life cycle as well as I thought I did. Corey Floyd was right. The viewDidLoad:
method can also get called multiple times, because UIViewController
will unload its view in low memory situations if the view isn't being displayed. When the user switches back to the view, viewDidLoad
gets called again to reconstruct the view.
How embarrassing.
Upvotes: 2
Reputation: 2874
I have an idea that might help:
hope this will help.
Upvotes: 0