Reputation: 419
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
Upvotes: 1
Views: 360
Reputation: 12780
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;
Upvotes: 1