开发者

uitextfield logical limit

I have a textfield that I want to set a开发者_如何学C limit, not the digit value, but numerical (numeric keypad). For example, if my limit is 59 and I press 6, all other numbers you should disable. Do you think it possible?

Thanks a lot!


No. Its not possible to disable the keys in the keyboard. You have to write your logic to prevent certain text to be entered in the text field.

You would probably have to write your code inside textField:shouldChangeCharacterInRange: method.


Not possible to disable keys on the keyboard. But...

Assuming you got a numeric keyboard, listen for the keyboard events, and delete data from the text field when the value reaches a value higher than 59.

Also provides user feedback, like a device vibration, so the user will know a wrong value was entered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜