Cocoa-Touch - Make a read-only UITextField become first responder

802 Views Asked by At

I have a UITextField which I have set it's inputView to be of a UIPickerView so the user can choose between a few values there. However I'm having trouble making the textfield become first responder.

If I set my textfield userInteractionEnabled = NO then it won't become first responder but if I set it to YES it will become first responder but then I will have a blinking cursor in there which I do not want. So how to make a read-only UITextField become first responder?

1

There are 1 best solutions below

0
On

From your question it looks you dont need a UITextField. So an alternative way to achieve this is to have a UILabel with a UIButton added on top, which will bring the picker. On selection of any value in picker, the UILabel text can be modified.