UIAlertController + addTextField orientation issue from iOS10 on iPad

*爱你&永不变心* 提交于 2019-12-11 05:14:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!