搜:
swift shouldReceiveTouch touch point
参考:
写成:
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
print("touch=\(touch)")
print("touch.view=\(touch.view)")
let touchPoint = touch.locationInView(self.view)
print("touchPoint=\(touchPoint)")
if CGRectContainsPoint(yourSubview.frame, touchPoint){
return true
}
else
{
return false
}
}即可。
转载请注明:在路上 » [已解决]swift中在UITapGestureRecognizer的shouldReceiveTouch获取touch的点的位置或区域