How do I set a different maximum character limit on text fields in one view in iphone?

I have a UIView with 10 UITextFields on it. I want to limit the different maximum character length on each UItextField. Suppose in the first textbox the max length should be 17, for the second and third it should be 2.how do I achieve this?

0


a source to share


1 answer


Embed UITextViewDelegate

with textView:shouldChangeTextInRange:replacementText

and return NO

when the length of the content of the text view is equal to or greater than the maximum length. The only exception to this is that it is replacementText

empty, in which case you should always returnYES



+1


a source







All Articles