UIView — “user interaction enabled” false on parent but true on child?

前端 未结 6 574
北海茫月
北海茫月 2020-12-08 13:02

It appears that userInteractionEnabled=NO on a parent view will prevent user interaction on all subviews. Is this correct? Is there any way around this?

6条回答
  •  一向
    一向 (楼主)
    2020-12-08 13:42

    I made up a weird solution for this, I had a child view in a tableView cell that I wanted to be touchable but the parent shouldn't have...

    Neither of above solutions worked for me, but I found another solution. Go to storyboard and add a tapGestureRecognizer to the parent view to absorb touches on parent view. Problem solved!

提交回复
热议问题