views:

1914

answers:

1

I am using a UITextField to get input for a price field. Since it is for price, I wanted to make a custom keyboard for just a numpad and a decimal button. I have the keypad view setup, however, I dont' know how to disable the default iphone keyboard completely. Any ideas?

+2  A: 

You can subclass UITextField and override canBecomeFirstResponder. Return NO and it will never put up a keyboard. However, you'll need to be in charge of handling touches so you can enable/disable your own keyboard. This may affect cut/copy/paste behavior so think about whether you really want to do this.

Ramin
thanks for the idea, I came up with an alternative solution. I made a uitextfield and disabled the "user interaction". Then i created an invisible custom button on top of the uitextfield that targets a function that launches the keyboard.
tul697
I have followup question now. Is there a way to enable the cursor even after disabling "user interaction"?
tul697