【发布时间】:2014-08-24 08:32:39
【问题描述】:
我们是否必须在 iOS8 中使用 UIAlertController 还是仍然可以使用 UIActionSheet?
我不希望对 iOS 8 兼容性的代码进行大量更改,但在 iPad 上使用 UIActionSheet 时遇到了几个问题。
例如,我在使用 UIActionSheet 时遇到此异常:
UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7c57bf90>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.
我知道最好使用新的 UIAlertController,但是为了继续使用 UIActionSheet,是否有任何解决方法?
同样在 UIActionSheet 实际显示的地方(无一例外)它包含一个箭头 + 它不像以前那样居中(iOS7) - 我正在使用 showInView(也尝试使用 showFromRect 但得到相同的结果) .
【问题讨论】:
-
您是否使用弹出框在 iPad 上展示
UIAlertController? -
我仍然不想迁移到新的 UIAlertController,我正在使用 UIActionSheet。
-
我在我们的应用程序中看到了同样的问题。 UIActionSheet 似乎在 iOS 8 中被破坏了。不幸的是,UIAlertController 的 API 非常不同,因此编写支持这两种操作系统版本的代码是很痛苦的。
-
我通过添加 UIActionSheet 类别找到了解决方案阅读我的问题我写了有问题的解决方案,stackoverflow.com/questions/24363761/…
标签: ios ipad ios8 uiactionsheet uialertcontroller