iOS保留UIWebView的状态? [英] iOS preserve state of UIWebView?

查看:106
本文介绍了iOS保留UIWebView的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在当前应用启动中保留UIWebView的状态(例如当前网页,后退/前端列表)?例如,如果我取消分配webview,并且在将来的某个时刻,我想重新创建它 - 是否可以将其赋予先前状态?

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?

推荐答案

良好方法

在iOS 6及更高版本中,如果为此视图的 restorationIdentifier 属性,它会尝试保留其网址历史记录,每页的缩放和滚动位置,以及当前正在查看哪个页面的信息。在恢复期间,视图会恢复这些值,以便Web内容像以前一样显示。有关状态保存和恢复如何工作的详细信息,请参阅 iOS应用程序编程指南

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.

这篇关于iOS保留UIWebView的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆