bea*_*rob 7 keyboard objective-c ios uialertcontroller
我有一个UIAlertController从提出UIViewController这是在推UINavigationController作为最后UIViewController.这里面UIAlertViewController有一个UITextField.
我的问题是,当我选择UITextField键盘显示,但UIAlertViewController保持居中,并部分隐藏在键盘下.
我的代码看起来像这样:
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Enter Your PIN" message:@"Please enter your PIN!" preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
        [textField setSecureTextEntry:YES];
    }];
UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"Confirm"
                                                       style:UIAlertActionStyleDefault
                                                     handler:^(UIAlertAction * _Nonnull action) {  }];
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
                                                           style:UIAlertActionStyleCancel
                                                         handler:^(UIAlertAction * _Nonnull action) {
                                                         }];
[alert addAction:okAction];
[alert addAction:cancelAction];
[self presentViewController:alert animated:YES completion:nil];
键盘显示在专用窗口中。警报、视图控制器(请参阅应用程序委托的window属性)等也是如此。windowLevel实例UIWindow决定了窗口的 z 顺序(即窗口如何在彼此上方/下方呈现)。
我们在应用程序中看到了相同的行为,我们使用自定义窗口进行自定义警报,该窗口始终显示在键盘窗口下方。看起来窗口级行为在 iOS 9/10 版本期间的某个时刻发生了变化,因此键盘的窗口始终位于窗口堆栈的顶部。
由于UIAlertController的窗口是由系统管理的,因此第三方开发人员可能无法修改此行为。
然而,要检查警报窗口的窗口级别,您可以在呈现它之后引用其viewswindow属性(例如,在呈现函数的完成块中)。windowLevel甚至可能将其更改为一个非常大的值,以尝试强制警报的窗口级别。
要跟踪此问题,您可以复制此雷达。
| 归档时间: | 
 | 
| 查看次数: | 1558 次 | 
| 最近记录: |