我已经在DetailVC中实现了SFSafariViewController,其中包括textView,标签和按钮。单击该按钮将打开一个URL。我遇到的问题是;单击该按钮后,它将在SFSafariVC中打开一秒钟,并恢复为原始的webView外观。我是否需要向viewController添加一些代码来控制对DetailVC的设置?因为它不解决SFSafariVC还是应该解决?不确定如何进行?我问了很多问题,但仍在学习如何正确编码。
我已经搜索了,找不到答案。
//这是viewController上的代码:
# my solution
3.2 ms ± 294 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
# blhsing's solution
6.08 ms ± 714 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
//这是detailVC的代码,我在其中添加了SFSafariVC。
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let selectedState = selectedStates[indexPath.section]
let state = selectedState.states[indexPath.row]
youselectedState = state
performSegue(withIdentifier: "AgreementDetails", sender: nil)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "AgreementDetails"{
let StateDetailVC = segue.destination as! StateDetailViewController
StateDetailVC.state = youselectedState
}
}
}