Swift2 如何在tvOS中实现UIAlertController
我正在tvOS平台中实现Swift2 如何在tvOS中实现UIAlertController,swift2,tvos,uialertcontroller,uialertaction,tvos9.1,Swift2,Tvos,Uialertcontroller,Uialertaction,Tvos9.1,我正在tvOS平台中实现UIAlertController。它的工作很好,但当我点击按钮的行动,然后行动是不调用。但当用两个按钮上下移动并点击任何一个按钮时,动作就会调用 这是我的密码 func showAlertMessage() { let alertController = UIAlertController(title: kAlertMessage, message: "", preferredStyle: UIAlertControllerStyle.Alert)
UIAlertController
。它的工作很好,但当我点击按钮的行动,然后行动是不调用。但当用两个按钮上下移动并点击任何一个按钮时,动作就会调用
这是我的密码
func showAlertMessage() {
let alertController = UIAlertController(title: kAlertMessage, message: "", preferredStyle: UIAlertControllerStyle.Alert)
let cancelButton = UIAlertAction(title: kCancelButton, style: UIAlertActionStyle.Default) { (action) -> Void in
self.dismissView()
}
let retryButton = UIAlertAction(title: kRetryButton, style: UIAlertActionStyle.Default) { (action) -> Void in
if self.playerObj != nil{
if self.controlFlag == false {
self.playerItem?.removeObserver(self, forKeyPath: "status")
}else{
self.playerItem?.removeObserver(self, forKeyPath: "status")
}
self.playerObj = nil
self.playerItem = nil
self.asset = nil
}
self.parseJSON()
}
alertController.addAction(retryButton)
alertController.addAction(cancelButton)
if self.alertMessageFlag != true {
dispatch_async(dispatch_get_main_queue()) { () -> Void in
self.presentViewController(alertController, animated: true, completion: nil)
}
}
}
请找出问题并向我提出建议。
多谢各位