XCODE iphone 6 plus和6s plus在显示时显示警告UIAlertViewController
我是iOS开发的新手。我试图显示UIAlertController
一个按钮被按下时(其实,故事情节是空的,这里只有1按钮,在故事板),使用下面的代码XCODE iphone 6 plus和6s plus在显示时显示警告UIAlertViewController
@IBAction func showAlert(sender: UIBarButtonItem) {
let alert = UIAlertController(
title: "Create new",
message: "Hi",
preferredStyle: UIAlertControllerStyle.Alert
)
let createAction = UIAlertAction(title: "Ok", style: .Default, handler: nil)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
alert.addAction(createAction)
alert.addAction(cancelAction)
alert.addTextFieldWithConfigurationHandler {
$0.placeholder = "Test placeholder"
}
presentViewController(alert, animated: true, completion: nil)
}
iphone 5,5S,6,6S不显示警告,然而iphone 6plus和6S加显示警告
2015年10月20日22:38:54.007 TestApp [3128:48601]的 UICollectionViewFlowLayout的行为不是限定,因为: 2015年10月20日22时38分:54.008 TestApp [3128:48601]物品高度必须小于UICollectionView的 高度减去区段顶端顶部和底部 值,减去内容的顶部和底部值。二○一五年十月二十〇日 22:38:54.008 TestApp [3128:48601]相关 UICollectionViewFlowLayout实例是 < _UIAlertControllerCollectionViewFlowLayout:0x7fd6b8582d90>和它 附接到; layer =; contentOffset:{0, 0}; contentSize:{0,0}>集合视图布局: < _UIAlertControllerCollectionViewFlowLayout:0x7fd6b8582d90>。
如果我删除UIAlertController
上的文本字段或删除2个按钮(保持文本字段显示),它不显示警告。任何解释为何发生这种情况如何解决警告?
尝试:
yourAlertController.view.setNeedsLayout()
只是presentViewController:
编辑呈现前:我已提交了此漏洞给苹果
我也有我的屏幕相同的问题只有iphon6加屏幕。请检查,如果你不及格的空衔,如果标题是空的,它传递零,如:中
UIAlertController *confirmAlert = [UIAlertController alertControllerWithTitle:nil message:displayMessage preferredStyle:UIAlertControllerStyleAlert];
代替
UIAlertController *confirmAlert = [UIAlertController alertControllerWithTitle:@"" message:displayMessage preferredStyle:UIAlertControllerStyleAlert];
它固定我的问题。祝你好运..
这可能是愚蠢的,但尝试在两个动作之前添加文本字段。 – rmaddy
@rmaddy它仍然显示警告。无论如何,我只是尝试添加2个文本字段,并且它没有在所有平台上显示警告,我在添加2个操作('Default'和'Cancel')之前和之后添加了它。 –
向Apple提交错误。包括一个简单的测试应用程序,演示该问题。 – rmaddy