Swift - UIAlertController没有显示任何内容

时间:2015-01-28 05:10:07

标签: 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)

1 个答案:

答案 0 :(得分:1)

为了它的价值,除非我将视图嵌入导航控制器中,否则我无法显示UIAlertControllers(因此使用Xcode 6'默认"单一视图&#34 ;模板可以像你这样设置它。)