iOS App 内嵌网页

Mobile Safari- the iOS SDK provides APIs for you to open a specific URL in the built-inMobile Safari browser. In this case, your users temporarily leave the application andswitch to Safari.

UIWebView / WKWebView- Before the release of iOS 9, this is the most convenient

way to embed web content in your app. You can think ofUIWebViewas a stripped-down

version of Safari. It is responsible to load a URL request and display the web content.

WKWebView, introduced in iOS 8, is an improved version ofUIWebView. It has the benefit of

the Nitro JavaScript engine and offers more features. If you just need to display a specific

web page,UIWebVieworWKWebViewis the best option for this scenario.

iOS 9 才有 SFSafariViewController- this is a new controller introduced in iOS 9. While

UIWebViewallows you embed web content in your apps, you have to build a custom web

view to offer a complete web browsing experience. For example,UIWebViewdoesn't come

with the Back/Forward button that lets users navigate back and forth the browsing

history. In order to provide the feature, you have to develop a custom web browser using

UIWebView. In iOS 9, Apple introducedSFSafariViewControllerto save developers from

creating our own web browser. By usingSFSafariViewController, your users can enjoy all

the features of Mobile Safari without leaving your apps.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容