Quantcast
Viewing all articles
Browse latest Browse all 5

Limit the size of UITextField

// Text field delegates
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  if ([[textField text] length] + [string length] - range.length > MAX_LENGTH) {
    return NO;
  } else {
    return YES; 
  }
}

https://gist.github.com/1175468


Viewing all articles
Browse latest Browse all 5

Trending Articles