Error showing a UIAlertView in swift

前端 未结 7 2059
独厮守ぢ
独厮守ぢ 2021-02-20 06:11

Im trying to show a UIAlertView in my swift App

    alert = UIAlertView(title: \"\",
        message: \"bla\",
        delegate: self,
        cancelButtonTitle:         


        
7条回答
  •  眼角桃花
    2021-02-20 06:39

    Swift 5

    You should do it this way:

    let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
    alert.addAction(UIAlertAction(title: "Button", style: .default, handler: nil))
    self.present(alert, animated: true, completion: nil)
    

提交回复
热议问题