ios - Swift - UIAlertController 没有显示任何内容

标签 ios swift

我做错了什么?我已经在 iOS 8.1 模拟器和装有 iOS 8.1 的 iPod Tocuh 5G 上对此进行了测试。

var alert = UIAlertController(title: "Also save this picture?", message: "Adding this picture to your Camera Roll might be a good idea.", preferredStyle: UIAlertControllerStyle.Alert)
            alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default, handler: { (action: UIAlertAction!) in
                     UIImageWriteToSavedPhotosAlbum(takenImage, nil, nil, nil)
                }))
            alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Cancel, handler: nil))
            self.presentViewController(alert, animated: true, completion: nil)

最佳答案

就其值(value)而言,我无法让 UIAlertControllers 显示出来,除非我将 View 嵌入到导航 Controller 中(因此使用 Xcode 6 的默认“单一 View ”模板可以像这样为您设置它)。

关于ios - Swift - UIAlertController 没有显示任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28185051/

相关文章:

ios - 在调整 UIScrollView 大小时调整内容比例和偏移量

iOS:我可以检测设备屏幕是否打开/关闭吗?

ios - 栏按钮项目从导航 Controller 中消失

swift - 当我将 UITextField 的输入传递给变量或 UserDefault 时,变量/UserDefault 最终为零

ios - 单元测试未在 IOS swift 5 上运行

ios - Xcode 10 不支持 Subversion **[SVN]**

ios - iOS ADAL-使用刷新 token 进行静音调用

ios - 在后台模式下定期向服务器发送小数据

ios - 如果创建 BLE 应用程序,我的应用程序应该支持哪个最低 iOS 版本?

ios - didSelectItemAtIndexPath 修改 UICollectionView 中的多个单元格