iPhone/iOS: How to implement Drag and Drop for subviews of a Scrollview?

后端 未结 5 1207
盖世英雄少女心
盖世英雄少女心 2020-12-09 20:50

I am having an horizontal scrollview in an UIViewController, where i have many images in small sizes. I am keeping the images in scrollview because the images a

5条回答
  •  醉话见心
    2020-12-09 21:40

    Hi Getsy,

    I am not going to provide you code directly but give idea how to manage this.

    You can manage this way, When you get touch on your object in scrollView at that time or when you move that object by draging at that time disable scroll by myScroll.scrollEnabled = NO;

    Then When on endTouch you can enable Scroll by myScroll.scrollEnabled = YES; So by this you can manage you object moving in scroll hope you got logic.

    Here is the demo code : Drag and Drop with ScrollView. which has same logic of Disabling scroll view on touchesMoved: and Enabling scroll view on touchesEnded:.

提交回复
热议问题