我想关闭SFSafariViewController而不需要用户点击左上角的“完成”按钮。
let svc = SFSafariViewController(URL: NSURL(string: "http://spotify.com")!)
self.presentViewController(svc, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我在这里添加这个解决方案,因为我正在寻找相同的行为,但没有找到任何好的答案。
像这样展示你的 SFSafariViewController :
let URL = NSURL(string: "www.to-load.com")
let webVC = SFSafariViewController(url: URL! as URL)
present(webVC, animated: true)
webVC.loadViewIfNeeded()
Run Code Online (Sandbox Code Playgroud)
然后你就可以像这样关闭它。
self.navigationController?.popViewController(animated: true)
self.dismiss(animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
是的,我确实检查过,它有效。
| 归档时间: |
|
| 查看次数: |
5297 次 |
| 最近记录: |