Writing handler for UIAlertAction

后端 未结 9 893
北恋
北恋 2020-11-28 05:10

I\'m presenting a UIAlertView to the user and I can\'t figure out how to write the handler. This is my attempt:

let alert = UIAlertController(ti         


        
9条回答
  •  -上瘾入骨i
    2020-11-28 05:23

    create alert, tested in xcode 9

    let alert = UIAlertController(title: "title", message: "message", preferredStyle: UIAlertControllerStyle.alert)
    alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: self.finishAlert))
    self.present(alert, animated: true, completion: nil)
    

    and the function

    func finishAlert(alert: UIAlertAction!)
    {
    }
    

提交回复
热议问题