Reputation: 137
I am trying to get data into textfield from UIbuttons, but when the user clicks on the textfield, the keyboard popups and if I disable the user interaction textfield, it won't allow me to use deleteBackward()
method, Used when user wants to delete a character of text field.
Help please.
Upvotes: 1
Views: 2643
Reputation: 398
put textField.resignFirstResponder() it will stop popup keyboard
Upvotes: -1
Reputation: 3446
You should create subclass of textfield and override canBecomeFirstResponder
method.
To NOT display keyboard, return false from canBecomeFirstResponder
method.
UPDATE
If you want cursor in your textfield when you touch it, juts assign blank view to inputview.
textField.inputView = UIView();
Upvotes: 2
Reputation: 17354
Why don't you instead of using deleteBackward() just set text without last character? This way, you can just disable userInteraction and get exactly same results.
Along with this, you can consider using UILabel, instead of UITextField
Upvotes: 0