I’m popping up a UIAlertView
with a UITextField
in it. I want the text field to auto-capitalize all words. I’m doing this by setting properties of the text field, but they have no effect at runtime. Here’s my code:
UIAlertView* alert = [[UIAlertView alloc] initWithTitle: title
message: message
delegate: self
cancelButtonTitle: @"Cancel"
otherButtonTitles: @"Create", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField* titleField = [alert textFieldAtIndex: 0];
titleField.autocapitalizationType = UITextAutocapitalizationTypeWords;
[alert show];
this autocapitalization is working on UITextField
form XIB
but this is not working on UIAlertView ,i am using iOS 6.
If it doesn't change your requirements, using
titleField.autocorrectionType = UITextAutocorrectionTypeDefault;
along with
titleField.autocapitalizationType = UITextAutocapitalizationTypeWords;
gives you the desired effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With