[已解决]swift中在UITapGestureRecognizer的shouldReceiveTouch获取touch的点的位置或区域

搜:

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
        }
}
即可。


发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量