When a text field is tapped I would like to have my own code present a picker and not have the keyboard come up at all. This seems really easy but I can't seem to figure it out. Has anyone else done this?
Well I ended up disabling user interaction and disabling the text fields. They just sit there now and don't interact with any touches but I can change the content in the code. I thought about determining if the touches were in the frame but it seemed like a lot of effort. I was using IB for this view so I added invisible buttons over the text fields that would pick up touches.
Interesting thing is that when the alpha is less than 0.02 the buttons didn't pickup the "touch up inside" action. I didn't think this was normal behavior, specially for it to stop working at 0 and 0.1, it just didn't make any sense.
I ended up putting the button behind the disabled text field and it picks up the touches. If anyone does figure out how to suppress the keyboard and still pick up touch events from a text field I would love to know.
Thanks, that was actually probably a lot easier than what I did.
I hadn't used touchesBegan before and I assumed it would be a lot more difficult. So in theory if I threw that in the view controller and put my text box name it would work or would I have to do something else?
Suppress editing of the field with
[textField setEditable:NO];
and then in the touch handler see if the touch was within textField's frame
(I have not tried this so YMMV)
When you do this, you no longer have a flashing cursor. Is there a way to do this so that one just looses the keyboard but doesn't loose the cursor and the clear button. That way you could place the cursor within the text and not just at the end and thereby insert or delete characters.
I've tried implementing a UITextFieldDelegate and sending [textField resignFirstResponder] but that doesn't work.