how can I show only number format input in UITextField?
I am making simple application that will take hotel name and price of item, and I want to show the price in only number format, because it can not be in alphabatical format, so what should I do add in code so that only number will be inputted in the Price UITextFiel开发者_StackOverflow社区d?
If you are not getting my question, you may ask anything again I do appreciate if I will get proper way of doing this,
If you want your text field to accept only the numbers, you can set it's keyboardType
property to UIKeyboardTypeNumberPad
.
[yourTextField setKeyboardType:UIKeyboardTypeNumberPad];
There are different types of keyboardTypes available, which you can refer in UITextInputTraits Protocol Reference.
This could be done in the Interface Builder as well:
精彩评论