搜:
swift shouldReceiveTouch touch point
参考:
写成:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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的点的位置或区域