Reputation: 470
extension UITextField {
override func target(forAction action: Selector, withSender sender: Any?) -> Any? {
if #available(iOS 10, *) {
if action == #selector(UIResponderStandardEditActions.paste(_:)) {
return nil
}
} else {
if action == #selector(paste(_:)) {
return nil
}
}
return super.target(forAction: action, withSender: sender)
}
}
I have done with disabling "Paste" option but not able to disable "Replace" option
Upvotes: 1
Views: 648
Reputation: 7405
It may not be the correct solution but may be useful:
textField.autocorrectionType = .no
where textField
is your desired UITextField
.
Upvotes: 1