How to Cancel Scrolling in UIScrollView

前端 未结 6 1991
情话喂你
情话喂你 2020-12-28 18:14

I use UIScrollView to make large-sized (larger than 320px) UI on iPhone.

I made an instance of UIScrollView and added some subviews on it. The problem is that I want

6条回答
  •  离开以前
    2020-12-28 18:39

    If you want to detect touches inside any of the subviews of the UIScrollView, you will have to subclass UIScrollView and override the touchesShouldBegin and touchesShouldCancelInContentView methods which are specifically created for this purpose.

    Other than this, there is no way you can identify touches in the subviews as UIScrollView tends to handle all touches itself and doesn't pass them to its subviews.

    All the best.

提交回复
热议问题