Nis*_*air 4 uitextfield swift swift3
我尝试了针对这个类似问题发布的每个答案,但它在 Swift 3 中不起作用。
override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool {
if action == #selector(paste(_:)) {
return false
}
return super.canPerformAction(action, withSender: sender)
}
Run Code Online (Sandbox Code Playgroud)
谢谢
小智 5
如果有人在寻找 swift 4.2
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
OperationQueue.main.addOperation {
UIMenuController.shared.setMenuVisible(false, animated: false)
}
return super.canPerformAction(action, withSender: sender)
}
Run Code Online (Sandbox Code Playgroud)