Safari Safari - 1 year ago 193
iOS Question

Uppercase characters in UItextfield

I have a question about

iOS UIKeyboard

I have a
and I would to have the
with only uppercase characters.

I use a
and I tried to set the
as "
All characters
" to
UITextField properties

But this not solve my problem...any suggestion?

Answer Source

Set your textfield type autocapitalizationType to UITextAutocapitalizationTypeAllCharacters on the UITextField

self.yourTexField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;

After call delegate

// delegate method

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
    NSRange lowercaseCharRange = [string rangeOfCharacterFromSet:[NSCharacterSet lowercaseLetterCharacterSet]];

    if (lowercaseCharRange.location != NSNotFound) {
        textField.text = [textField.text stringByReplacingCharactersInRange:range
                                                                 withString:[string uppercaseString]];
        return NO;

    return YES;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download