I have a view controller that has a web view. What I'm wanting to know is if it is possible to keep the current page info available so that if the user goes elsewhere in my app and comes back to the web view, it will show the last page the user was on and not always load the url defined in viewDidLoad.
Asked
Active
Viewed 89 times
0
-
possible duplicate of [iOS preserve state of UIWebView?](http://stackoverflow.com/questions/20960260/ios-preserve-state-of-uiwebview) – Michał Ciuba Dec 09 '14 at 14:56
1 Answers
2
Save your current url in view will disappear to lets say NSUserDefaults like:
-(void)viewWillDisappear:(BOOL)animated{
NSString *currentURL = currentWebView.request.URL.absoluteString;
//save to NSUserDefaults
}
then in viewWillAppear get this url and load webview

Yanchi
- 1,030
- 1
- 20
- 31