Quantcast
Channel: User Sargis - Stack Overflow
Viewing all articles
Browse latest Browse all 37

Answer by Sargis for How to detect number length in UITextField?

$
0
0

Use this.

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{// _textLenghtLimit = your text max lenght    if (_textLenghtLimit > 0) {        if ((range.location >= _textLenghtLimit || textField.text.length + 1 > _textLenghtLimit) && range.length == 0) {            return NO;        }    }    return YES;}

Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>