IOS WebView 文档研究

前段时间在公司做了一个《装房通》的项目,里面内嵌了一个WebView,地址是这样的  zft.360zfw.com
由于这次内嵌的WebView,与ios通信比较多,而且需要做离线版本,躺的坑略多。
可能由于我的无知,照成与IOS工程师上的沟通问题。
于是认真读了一下ios 的webview文档
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/
有以下几个结论:
1。in apps that run in iOS 8 and later, use the KWebView class instead of using UIWebView
在ios8之后,应该使用KWebView,跟UIWebView一样,但是ios做了优化,占用内存少,对html5渲染更快。
2. https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKPreferences_Ref/index.html#//apple_ref/occ/instp/WKPreferences/javaScriptEnabled
javascript可被完全禁用
3.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/occ/instm/UIWebView/goBack
可控制WebVieW的前进与后退历史
4.By default, a web view automatically converts telephone numbers that appear in web content to Phone links. When a Phone link is tapped, the Phone app launches and dials the number. To turn off this default behavior, set the dataDetectorTypes property with a UIDataDetectorTypes bitfield that does not contain theUIDataDetectorTypePhoneNumber flag.
默认情况下,会识别电话号码的link,点解会触发打电话程序
5.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/occ/instp/UIWebView/scalesPageToFit
这个参赛会影响web的页面布局
6.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/occ/instp/UIWebView/delegate
js与ios 通信,一般是通过 document.location = ‘zft:app********’ url后面带上json,对与json的长度目前尝试的是6000也没有问题。
7.https://developer.apple.com/library/ios/qa/qa1630/_index.html#//apple_ref/doc/uid/DTS40008749

  • Excel (.xls)
  • Keynote (.key.zip)
  • Numbers (.numbers.zip)
  • Pages (.pages.zip)
  • PDF (.pdf)
  • Powerpoint (.ppt)
  • Word (.doc)

webview可以直接打开这些文件
8.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instp/UIViewController/restorationIdentifier
可以保存曾经浏览过的页面的滚动条位置
9.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/occ/instp/UIWebView/allowsInlineMediaPlayback
视频播放是否适用全屏模式
10.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/occ/instp/UIWebView/mediaPlaybackRequiresUserAction
是否允许js操作直接播放media
11.https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/c/tdef/UIWebPaginationMode
强制webview滚动方向

发表评论