swift - Xcode 6 或 iOS 8 错误 : UIAlertController Not Showing Message?

标签 swift ios8 uialertcontroller

在我的 View Controller 中,我有以下代码来创建 UIAlertController:

 var avc = UIAlertController(title: "Location", message: "Please Enter A Location", preferredStyle: UIAlertControllerStyle.Alert)
            self.navigationController!.presentViewController(avc, animated: true, completion: nil)

在模拟器中运行,我明白了

enter image description here

确定这是 Xcode 6 beta 7 或 swift 中的错误?想法?

最佳答案

找到答案了,我应该向 UIAlertController 添加一个 Action 来显示消息:

    alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))

关于swift - Xcode 6 或 iOS 8 错误 : UIAlertController Not Showing Message?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25713001/

相关文章:

ios - 当添加到 UICollectionView 时,layoutSubviews 会卡住应用程序

arrays - 在 Swift 中使用 .filter 和字典数组

ios - 扩展项目模板未出现在 Xcode 6 中

ios8 - UIDocumentInteractionController - MailCompose 在 iOS8 中不关闭

ios - UINavigationBar 外观属性不适用于 iOS 8

swift - 如何像android密码一样快速加密和解密?

swift - ARAnchor 返回 SIMD 4x4 向量 - 这是什么意思?

Swift UIAlert - 从 dataTaskWithRequest 获取数据

ios - 如何在 ios 8 的 alertview 中添加文本输入?

ios - 如何在 SWIFT 中关闭没有任何操作的 UIAlertController?