Customizing UIAlert keyboard behavior
Customizing UIAlert keyboard behavior
- Subject: Customizing UIAlert keyboard behavior
- From: Jens Alfke <email@hidden>
- Date: Wed, 19 Dec 2012 12:18:12 -0800
I’m popping up a UIAlert with a text field in it. I want the text field to auto-capitalize all words, and I want the Return key to dismiss the alert. 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;
titleField.returnKeyType = UIReturnKeyDone;
[alert show];
When I run this, (a) there is no auto-capitalization at all, and (b) pressing Return merely hides the keyboard. What else do I need to do? I’ve verified that titleField is not nil, so the properties are actually being set.
[Xcode 4.5.2. Have only tried this in the iOS 6 simulator yet, not on a real device.]
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden