Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS preserve state of UIWebView?

Is it possible to preserve the state of the UIWebView (e.g the current webpage, back/front list) in the current app launch? For example, if I dealloc a webview, and at some point in the future, I want to recreate it - is it possible to give it the prior state?

like image 527
Alex1987 Avatar asked Jan 06 '14 22:01

Alex1987


1 Answers

Good Approach

In iOS 6 and later, if you assign a value to this view’s restorationIdentifier property, it attempts to preserve its URL history, the scaling and scrolling positions for each page, and information about which page is currently being viewed. During restoration, the view restores these values so that the web content appears just as it did before. For more information about how state preservation and restoration works, see iOS App Programming Guide.

like image 56
codercat Avatar answered Sep 28 '22 07:09

codercat