ios - Set range of numerical values for a text field -
i have text field must take numerical value of specific range only, m n. have gone through many articles how set maximum length text field. need set text field takes values of range, 23 103. managed make sure that text field takes numerical values setting keyboard type number pad. please help.
you can check value when user finished editing textfield.
set textfield's delegate view controller , then:
- (bool)textfieldshouldreturn:(uitextfield *)textfield { nsstring *stringvalue = textfield.text; nsinteger integer = [stringvalue intvalue]; if (integer <23 || integer > 103) // can make text red here example return no; else return yes; }
Comments
Post a Comment