1

I would like to detect drag and touch on a uiimageview. How do i do that? I need to implement code like this in the event for image flipping. iOS 4.2: Flip image using block animations

Community
  • 1
  • 1
user1302602
  • 419
  • 2
  • 6
  • 16

1 Answers1

1

for drag and touch for your Image View you have to assign GestureRecognizer

//drag your object
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
[self.imageSubVw addGestureRecognizer:panRecognizer];

// scale your object
UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchDetected:)];
[self.imageSubVw addGestureRecognizer:pinchRecognizer];

// rotate your object
UIRotationGestureRecognizer *rotationRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationDetected:)];
[self.imageSubVw addGestureRecognizer:rotationRecognizer];

panRecognizer.delegate = self;
pinchRecognizer.delegate = self;
rotationRecognizer.delegate = self;
Hiren
  • 12,720
  • 7
  • 52
  • 72