iosnumbersuitextfield

TextField Keyboard startup in Number mode


I need the UITextField "ASCII Capable" keyboard to come up in numeric mode. I can't find an API for this, what am I missing?


Solution

  • Assuming you have a UITextField named textField, all you need to do is call the method:

    [ textField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation ];
    

    You may need to call this before the keyboard is displayed.