[英]How to close SFSafariViewController automatically?
I want to close SFSafariViewController
without user need to tap on the Done button on the top left corner. 我想关闭SFSafariViewController
而无需用户点击左上角的完成按钮。
let svc = SFSafariViewController(URL: NSURL(string: "http://spotify.com")!)
self.presentViewController(svc, animated: true, completion: nil)
I add this solution here , because i was looking for same behaviour and i didn't find any good answer. 我在这里添加此解决方案,因为我正在寻找相同的行为,我没有找到任何好的答案。
Present your SFSafariViewController like that: 像这样展示你的SFSafariViewController:
let URL = NSURL(string: "www.to-load.com")
let webVC = SFSafariViewController(url: URL! as URL)
present(webVC, animated: true)
webVC.loadViewIfNeeded()
and then you can close it like that. 然后你可以这样关闭它。
self.navigationController?.popViewController(animated: true)
self.dismiss(animated: true, completion: nil)
Yes, i did check that , it works. 是的,我确实检查过,它有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.