最佳答案
创建一个返回 false 的无案例,并在 3D 触摸启动时调用该案例,并在 3D 触摸结束时调用选择案例。
override public func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool
{
switch self.currentState {
case .select:
if action == #selector(select(_:)) || action == #selector(selectAll(_:))
{
return true
}
case .copy:
if action == #selector(copy(_:))
{
return true
}
case .paste:
if action == #selector(paste(_:)) || action == #selector(select(_:)) || action == #selector(selectAll(_:))
{
return true
}
case .none:
return false
}
return false
}
关于swift - 在文本字段中快速进行 3D 触摸时关闭编辑菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46499704/