0

I have a UITextField. How can I make sure that the first character is uppercase?

I tried this.

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSUInteger newLength = [textField.text length] + [string length] - range.length;
if (newLength == 1) {
    string = [string uppercaseString];
}

return YES;

}

But even after uppercasing the string, it is still lower case.

Thanks, Tee

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
teepusink
  • 27,444
  • 37
  • 107
  • 147
  • possible duplicate of [Set the maximum character length of a UITextField](http://stackoverflow.com/questions/433337/set-the-maximum-character-length-of-a-uitextfield) – iosMentalist Oct 08 '14 at 08:48

1 Answers1

0

Ah I got it. There is the capitalize option in Interface Builder.

Thanks, Tee

teepusink
  • 27,444
  • 37
  • 107
  • 147