2

I am using icarousel in my iPad application. I want a functionality like drag and drop of objects in that icarousel. Drag in a view out of the carousel to delete an item from it and drop a view in the carousel to add an item to in. I have downloaded icarousel from https://github.com/nicklockwood/iCarousel

I have tried the drag and drop functionality using the delegate methods

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

but whole the view is messed up. please help me out here. thank you in advance.

Harald K
  • 26,314
  • 7
  • 65
  • 111
Naveen
  • 900
  • 1
  • 7
  • 23

2 Answers2

3

This is kind of an old post, but just in case you are still stuck, here is what we do.

To pull a view out:

  1. Add a pan gesture recognizer to the iCarousel
  2. Mark the point of the touch on recognizerStateBegan
  3. Adjust the frame or transform of the view on recognizerStateChanged
  4. Check the location on recognizerStateEnded

    4.1 Return item if not fully out

    4.2 Delete item from data source if fully out

  5. Reload iCarousel

You can do something very similar to views that you drop on the iCarousel but in reverse.

MobileVet
  • 2,958
  • 2
  • 26
  • 42
0

All you need can be found in this sample project: https://github.com/firdousali86/SampleDragDropCarousel

Firdous
  • 4,624
  • 13
  • 41
  • 80