如何使用UIGestureRecognizer隐藏PKHUD?

时间:2016-07-13 20:45:21

标签: ios swift uigesturerecognizer

我尝试添加UIGestureRecognizer以在用户触摸时隐藏HUD。这是我的代码:

let gesture = UITapGestureRecognizer(target: self, action: #selector(someAction(_:)))
PKHUD.sharedHUD.contentView.userInteractionEnabled = true
PKHUD.sharedHUD.contentView.addGestureRecognizer(gesture)

// ...

func someAction(sender:UITapGestureRecognizer){
    // do task
}

但触摸HUD时从不调用someAction。任何想法如何隐藏PKHUD?我知道,有一个HUD.hide()方法,但我希望用户决定视图何时消失。

1 个答案:

答案 0 :(得分:0)

尝试使用:

PKHUD.sharedHUD.dimsBackground: Bool
相关问题