Set the maximum character length of a UITextField
While the UITextField class has no max length property, it’s relatively simple to get this functionality by setting the text field’s delegate and implementing the following delegate method: Objective-C – (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { // Prevent crashing undo bug – see note below. if(range.length + range.location > textField.text.length) { return NO; } NSUInteger … Read more