I have a UIAlertView with a textfield inside (UIAlertViewStylePlainTextInput) that automatically pops up a keyboard in iOS 7. However, when I upgraded to iOS 8, the keyboard didn't automatically popup and instead I would have to tap on the textfield to get the keyboard to popup. Is there anyway to restore that automatic keyboard popup to the UIAlertView textfield when I call it?
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"" message:@"The amount?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeNumberPad;
[alertTextField setTextAlignment:NSTextAlignmentCenter];
[alert show];
[alert release];
Update: [alertTextField becomeFirstResponder];
does not work nor does
[[alert textFieldAtIndex:0] setDelegate:self];
[[alert textFieldAtIndex:0] becomeFirstResponder];
Also, there is a textfield flashing indicator inside the textview, which is problematic because there is no actual keyboard that pops up automatically until the user taps on the textfield itself.
I had to unselect "Connect Hardware Keyboard" in the iOS Simulator Hardware->Keyboard menu options for running in iOS 8.
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