【问题标题】:Using alertview in ios 9 with swift在 ios 9 中快速使用 alertview
【发布时间】:2016-07-26 12:54:34
【问题描述】:

当我在 ios 9 中使用 swift 使用 alertview 时,编译器会显示以下警告消息:

UIAlertView' 在 iOS 9.0 中已弃用: UIAlertView 已弃用。改用 UIAlertController 和 UIAlertControllerStyleAlert 的preferredStyle

【问题讨论】:

标签: swift


【解决方案1】:

尝试使用此代码

let alert = UIAlertController(title: "TITLE", message: "MESSAGE", preferredStyle: UIAlertControllerStyle.Alert)
            let okAction = UIAlertAction(title:"OK", style: UIAlertActionStyle.Cancel, handler: { (action) -> Void in
            })
            alert.addAction(okAction)
            dispatch_async(dispatch_get_main_queue(),{
                self.presentViewController(alert, animated: true, completion: nil)
            })

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-01
    • 1970-01-01
    • 2019-07-05
    • 1970-01-01
    相关资源
    最近更新 更多