Faire pivoter le Zoom ImageView dans ScrollView?

J'ai un UIScrollView qui a un UIImageView zoom, c'est-à-dire qu'il implémente:

 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return self.imageView; } 

J'essaie d'append un UIRotationGestureRecognizer à cette imageView et je le fais comme suit:

 _rotationGestureRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)]; [self.imageView addGestureRecognizer:_rotationGestureRecognizer]; -(void)rotate:(id)sender { UIRotationGestureRecognizer *rotationGestureRecognizer = [(UIRotationGestureRecognizer*)sender retain]; if(rotationGestureRecognizer.state == UIGestureRecognizerStateEnded) { self.lastRotation = 0.0; return; } CGFloat rotation = 0.0 - (self.lastRotation - rotationGestureRecognizer.rotation); rotationGestureRecognizer.view.transform = CGAffineTransformRotate(rotationGestureRecognizer.view.transform, rotation); self.lastRotation = rotationGestureRecognizer.rotation; [rotationGestureRecognizer release]; } 

Je me demandais juste, est-il possible de faire cela? Il semble que UIScrollView bloque les touches de mon UIImageView parce que rien ne se passe. Apple recommand-t-il de ne pas le faire avec une vue agrandie dans un UIScrollView ?

Le code suivant est en train de fonctionner. Ajoutez un geste pour faire défiler la vue à la place de l'image.

  UIRotationGestureRecognizer* _rotationGestureRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)]; [self.scrollView addGestureRecognizer:_rotationGestureRecognizer]; 
 -(void)rotate:(UIRotationGestureRecognizer *)sender { [self bringSubviewToFront:[(UIRotationGestureRecognizer*)sender view]]; if([(UIRotationGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) { lastRotation = 0.0; return; } CGFloat rotation = 0.0 - (lastRotation - [(UIRotationGestureRecognizer*)sender rotation]); CGAffineTransform currentTransform = [(UIPinchGestureRecognizer*)sender view].transform; CGAffineTransform newTransform = CGAffineTransformRotate(currentTransform, rotation); [[(UIRotationGestureRecognizer*)sender view] setTransform:newTransform]; lastRotation = [(UIRotationGestureRecognizer*)sender rotation]; lastRotation = [(UIRotationGestureRecognizer*)sender rotation]; }