Here is a simple delegate method to limit the characters in UITextfield :-
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSUInteger newLength = [textField.text length] + [string length] - range.length;
return (newLength > 8) ? NO : YES;
}
1 comment:
Wow another useful post. You guys have really helped fellow iPhone developers. Do you offer any advertising opportunities?
Post a Comment