【发布时间】:2015-07-23 14:41:00
【问题描述】:
我已经覆盖了 UIViewController 中的 -inputAccessoryView: 方法,该方法返回一个视图,该视图显示在键盘顶部,当在 viewController 的视图上编辑 UITextField 时显示该视图。
-(UIView *)inputAccessoryView;
我还展示了来自 viewController 的 UIAlertController。
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Save Profile" message:@"You have made changes to your profile. Do you want to save them?" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
[alert addAction:[UIAlertAction actionWithTitle:@"Save" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
//Code to save the profile.
}]];
[self presentViewController:alert animated:YES completion:nil];
如您所见,我没有向 UIAlertController 添加任何文本字段。
奇怪的是,当 UIAlertController 出现时 inputAcessoryView 出现在屏幕底部。
这是一个错误,还是我忽略了什么?
【问题讨论】:
-
我也面临同样的问题。
标签: ios objective-c uiviewcontroller uialertcontroller presentviewcontroller