在xCode中显示消息框的最简单方法(代码)是什么?

时间:2018-09-10 18:04:05

标签: xcode

我只想显示一个带有OK按钮的消息。

这是我的代码。

但是有“一行”类型的代码吗?

        let alert = UIAlertController(title: "Warning", message: "Message", preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
        DispatchQueue.main.async {
            self.present(alert, animated: true, completion: nil)
        }

0 个答案:

没有答案
相关问题