alternativamente, establecer la propiedad KEYBOARDTYPE del campo de texto en el código:
textField.keyboardType = UIKeyboardTypeNumberPad
Las opciones disponibles son:
UIKeyboardType El tipo de teclado que se muestra en para una vista de texto determinada.
enum typedef {
UIKeyboardTypeDefault,
UIKeyboardTypeASCIICapable,
UIKeyboardTypeNumbersAndPunctuation,
UIKeyboardTypeURL,
UIKeyboardTypeNumberPad,
UIKeyboardTypePhonePad,
UIKeyboardTypeNamePhonePad,
UIKeyboardTypeEmailAddress,
UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable} UIKeyboardType;
Una palabra de advertencia, The NumberPad no tiene un punto decimal para la entrada. Si lo necesitas, tendrás que usar algo más.
Desde 2013 ... simplemente configurarlo como desee en InterfaceBuilder – Fattie