在iOS应用程序中加载网页 [英] Loading webpage inside iOS application

查看:148
本文介绍了在iOS应用程序中加载网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们加载网页,则可以将其转发到野生动物园,但这会导致用户离开我们的应用程序.有什么办法可以使用户访问任何网页,然后返回到我们的应用程序.

If we load a webpage, we can forward it to safari, but this causes users to leave our app. Is there any way so that a user visits any webpage and then come back to our application.

推荐答案

如果您希望iOS7之前的设备具有某些浏览器类型的功能,则可以使用此

If you want some browser type functionality for devices earlier then iOS7, you can use this inline browser

iOS 9更新: Apple引入了用于浏览Web的可见标准界面,即 SFSafariViewController (适用于iOS 9+设备)

iOS 9 Update: Apple has introduced a visible standard interface for browsing the web i.e. SFSafariViewController for iOS 9+ devices.

示例:

func showTutorial() {
    if let url = URL(string: "https://www.example.com") {
        let config = SFSafariViewController.Configuration()
        config.entersReaderIfAvailable = true

        let vc = SFSafariViewController(url: url, configuration: config)
        present(vc, animated: true)
    }
}

这篇关于在iOS应用程序中加载网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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