gpt4 book ai didi

ios - 如何自动关闭 SFSafariViewController?

转载 作者:搜寻专家 更新时间:2023-10-31 22:59:21 26 4
gpt4 key购买 nike

我想关闭 SFSafariViewController 而无需用户点击左上角的完成按钮。

let svc = SFSafariViewController(URL: NSURL(string: "http://spotify.com")!)

self.presentViewController(svc, animated: true, completion: nil)

最佳答案

我在此处添加此解决方案,因为我一直在寻找相同的行为,但没有找到任何好的答案。

像这样展示你的 SFSafariViewController:

    let URL = NSURL(string: "www.to-load.com")
let webVC = SFSafariViewController(url: URL! as URL)
present(webVC, animated: true)
webVC.loadViewIfNeeded()

然后你就可以关闭它了。

   self.navigationController?.popViewController(animated: true)
self.dismiss(animated: true, completion: nil)

是的,我确实检查过,它有效。

关于ios - 如何自动关闭 SFSafariViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39096902/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com