XCODE iphone 6 plus和6s plus在显示UIAlertViewController时显示警告

森蒂哈利姆

我是iOS开发的新手。我试图在UIAlertController单击按钮时显示一个(故事板为空,故事板中只有一个按钮),使用下面的代码

@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 Plus显示警告

2015-10-20 22:38:54.007 TestApp [3128:48601]未定义UICollectionViewFlowLayout的行为,因为:2015-10-20 22:38:54.008 TestApp [3128:48601]项目高度必须小于UICollectionView的高度减去该部分可插入顶部和底部值,减去内容可插入顶部和底部值。2015-10-20 22:38:54.008 TestApp [3128:48601]相关的UICollectionViewFlowLayout实例为<_UIAlertControllerCollectionViewFlowLayout:0x7fd6b8582d90>,并将其附加到; 层=; contentOffset:{0,0}; contentSize:{0,0}>集合视图布局:<_UIAlertControllerCollectionViewFlowLayout:0x7fd6b8582d90>。

如果我删除了上的文本字段UIAlertController或删除了2个按钮(保持显示的文本字段),则不会显示警告。为什么会发生这种情况的任何解释?如何解决警告?

威廉姆斯

尝试:

yourAlertController.view.setNeedsLayout()

在介绍它之前 presentViewController:

编辑:我已将此错误提交给Apple

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

iPhone 6S和iPhone 6S Plus的平台字符串是什么?

Xcode自动调整大小的XIB在iPhone 6s Plus上不正确

iPhone 6s plus设备中的UIPickerView UI和功能问题

iPhone 6s plus上的字体大小

iPhone 6s Plus尺寸屏幕在iPhone 6 Plus上被切断

Xcode for iPhone 6和6 Plus的居中表格视图

在iPhone 6S或iPhone 6S Plus模拟器上模拟强制触摸/ 3D触摸

原始/未经编辑的iPhone 6S / 6S Plus照片的图像长度/宽度(以像素为单位)是多少?

为iPhone 4S缩放文本输入-iPhone 6S Plus

Xcode 6自动为iPhone 6和6 plus调整应用程序的大小

Swift 2.0 Popover视图无法在iPhone 6s plus上获得正确的位置,但在iPhone 6s上可以正常工作

如何处理iPhone 6S Plus的字体大小?

自动布局在 iPhone 6s Plus 中没有按预期工作

在HTML模式下为iPhone 6s Plus在HTML模式下创建整页图像

支持iPhone 6和6 plus

UIImageview上的CAGradient层在iphone 6s plus中向上移动,同时在iphone 5中正确设置

仍未针对iPhone 6和iPhone 6 Plus优化

Xcode 10.3 无法在 iOS 13 iPhone 6s 上运行 - 此 iPhone 6s 运行的是 iOS 13.1,此版本的 Xcode 10.3 可能不支持

流式传输时iPhone 6S音频问题

更新的尺寸类别的xib在iPhone 6和iPhone 6 Plus中不显示iAd

iPhone 6和6 Plus媒体查询

iPhone 6和6 Plus的AutoLayout TableView问题

区分iPhone 5、6和6 Plus的尺寸等级?

iPhone 6和6 Plus中的tableview约束

iPhone 6(Plus)屏幕尺寸

iPhone 6 Plus上的UISplitViewController

检测iPhone5、5s,6和6 plus

背景图像不会显示在移动设备上 (iPhone 6s)

防止UIPopover在iPhone 6 plus上横向显示为UIPageSheet