Objective-C: Numbers only text field? [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Iphone UITextField only integer I want to place a text field that only accepts numbers (0-9, doesn't even need decimals), but even using the "Number Pad" entry option I still get a keyboard with various symbols on it. Is there a better control for this, is there a better control for what I'm doing, or do I just have to validate input manually? 回答1: The following code will allow you to only input numbers as well