The UITextField's Select, SelectAll, Cut, Copy functionality is shown by default, When I long press or Double Tap on the TextField. I do not require this all features. Please tell me how to disable long press or double tap gesture functionality.
Following code will disable those options:
You have to subclass the UITextField and try to use this code to disable/hide caret and input (copy/paste)
override func caretRectForPosition(position: UITextPosition!) -> CGRect {
            return CGRect.zeroRect
        }
    override func selectionRectsForRange(range: UITextRange) -> [AnyObject] {
        return []
    }
    override func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool {
        // Disable copy, select all, paste
        if action == Selector("copy:") || action == Selector("selectAll:") || action == Selector("paste:") {
            return false
        }
        // Default
        return super.canPerformAction(action, withSender: sender)
    }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With