问题
When I use UIAlertController with addTextField on iPad, the keyboard doesn't rotate properly from iOS10.
It was working fine with iOS9, does anybody know the way to fix it?
UIAlertController *alert = [UIAlertController
alertControllerWithTitle:@"title"
message:nil
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *done = [UIAlertAction actionWithTitle:NSLocalizedString(@"Done", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
UITextField *textField = alert.textFields.firstObject;
}];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:nil];
[alert addAction:cancel];
[alert addAction:done];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
}];
[self presentViewController:alert animated:YES completion:nil];
来源:https://stackoverflow.com/questions/40318488/uialertcontroller-addtextfield-orientation-issue-from-ios10-on-ipad