标签:elf 实现 透明 receive 需要 tar target 冲突 get
有时候我们在一个大的透明view上添加一个小的view,需要点击透明view时remove掉,但是我们不希望触碰到小的view上也remove就需要实现
UIGestureRecognizerDelegate:
private func addGesture() {
let tapGesture = UITapGestureRecognizer(target: self, action: Selector("handleTapGesture"))
tapGesture.delegate = self
self.addGestureRecognizer(tapGesture)
}
//MARK:UIGestureRecognizerDelegate 判断当前的view具体是谁
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
if touch.view!.isDescendantOfView(点击时候不消失的小view) {
return false
}
return true
}
标签:elf 实现 透明 receive 需要 tar target 冲突 get
原文地址:http://www.cnblogs.com/caodedi-88/p/6257024.html