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

前端 未结 6 571
北海茫月
北海茫月 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:26

    That's correct, userInteractionEnabled set to NO on a parent view will cascade down to all subviews. If you need some subviews to have interaction enabled, but not others, you can separate your subviews into two parent views: one with userInteractionEnabled = YES and the other NO. Then put those two parent views in the main view.

提交回复
热议问题