MBU
MBU

Reputation: 5098

textfield enable clear button but dont allow the keyboard to come up

Is there a way to have a UITextField with the text read only but still let the clear button work? I have a set of buttons on my view that interact with the text field so i dont need the keyboard to pop but if i disable the text field. the clear button shows up but i cant press it anymore. Is there a way to do this or should i make my own clear button?

Upvotes: 2

Views: 1209

Answers (1)

Anomie
Anomie

Reputation: 94794

Set clearButtonMode to UITextFieldViewModeAlways, and have the delegate return NO for textFieldShouldBeginEditing:.

Upvotes: 4

Related Questions