Detect if certain UIView was touched amongst other UIViews

后端 未结 8 1615
迷失自我
迷失自我 2020-11-30 02:30

I have 3 UIViews, layered on top of one large uiview. I want to know if the user touches the top one and not care about the other ones. I will have a couple of buttons in th

8条回答
  •  离开以前
    2020-11-30 02:50

    This worked for me:

    func respondToGesture(gesture: UIGestureRecognizer) {
        let containsPoint = CGRectContainsPoint(targetView.bounds, gesture.locationInView(targetView))
    }
    

提交回复
热议问题