ios - 禁用 SFSafariViewController 的下拉解散
问题描述
是否可以禁用下拉解除手势SFSafariViewController
?
似乎SFSafariViewController
在它自己的窗口中运行,因此,设置isModalInPresentation甚至设置presentationControllerShouldDismiss(_:)似乎没有任何作用。
SFSafariViewController
文档似乎也没有在这里指定任何内容。
MWE:
import SafariServices
import UIKit
class ViewController: UIViewController, UIAdaptivePresentationControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
let vc = SFSafariViewController(url: URL(string: "https://stackoverflow.com")!)
vc.modalPresentationStyle = .pageSheet
// `presentationControllerShouldDismiss` will be ignored, if isModalInPresentation is set to `true`
// vc.isModalInPresentation = true
vc.presentationController?.delegate = self
self.present(vc, animated: true)
}
}
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
return false
}
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
NSLog("Did dismiss")
}
}
解决方案
推荐阅读
- javascript - 我想在新的请求到来时取消我之前的请求
- python - 如何仅更改第一个“列名”熊猫的字体
- javascript - 如何从显示为空的 javascript 对象中读取?
- flutter - 用于移动和网络应用程序的颤振 1.9 yaml 文件?
- python - 这是一种在python中获取窗口大小的方法
- git - 您可以使用 Git 将代码部署到设备组吗
- cuda - 将 cudaMalloc 数据清零的好方法是什么?
- react-native - 使用 Express 通过 Cloud Functions 进行 Firebase 身份验证
- javascript - 使用 JavaScript 和/或 TinySort 按子元素的标准对父元素进行排序
- css - 具有明确定义的尺寸的 div 是用视口宽度缩放尺寸吗?