我有UIScrollView
一个 zooming UIImageView
,即它实现:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imageView;
}
我正在尝试添加一个UIRotationGestureRecognizer
,imageView
我这样做如下:
_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];
}
我只是想知道,是否有可能做到这一点?似乎UIScrollView
阻止了我的接触,UIImageView
因为什么都没有发生。Apple 是否建议不要在 a 中使用缩放视图来执行此操作UIScrollView
?