Search code examples
iphonekeyboarduitextfield

UITextField - how do i use a custom keyboard and disable the default keypad


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?


Solution

  • 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.