IOS How to Restrict length for UITextField
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)strin{
//Check that response is should be maximum 5 characters
if ([strin length] > 0) {
return [textField.text length] < 5;
}
return YES;
}
Comments
Post a Comment