Swift使用Dismiss警告消息

时间:2016-07-14 16:08:59

标签: swift swift2

我希望在快速语言中点击alertController时忽略提醒消息。 enter image description here

谢谢你的进步

1 个答案:

答案 0 :(得分:1)

您需要在viewDidLoad中以这种方式在视图中添加点按手势

let tapGesture:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.viewTapped(_:)))
self.view.addGestureRecognizer(tapGesture)

现在在viewTapped

中添加此ViewController
func viewTapped(sender: UITapGestureRecognizer){
    self.dismissViewControllerAnimated(true, completion: nil)
}