我有UIScrollView
,其中有UIImageView
。我需要能够旋转图像。 ScrollView正在拦截旋转手势。
self.scrollView = [[ScrollView alloc] initWithFrame:self.bounds];
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.delegate = self;
self.scrollView.clipsToBounds = YES;
self.scrollView.decelerationRate = 0.0;
self.scrollView.backgroundColor = [UIColor clearColor];
self.scrollView.layer.borderWidth = 2.0;
self.scrollView.layer.borderColor = [[UIColor whiteColor] CGColor];
[self addSubview:self.scrollView];
//self.imageView = [[UIImageView alloc] initWithFrame:self.scrollView.frame];
self.imageView = [[UIRotateImageView alloc] initWithFrame:frame];
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
self.imageView.backgroundColor = [UIColor blackColor];
[self.scrollView addSubview:self.imageView];
self.scrollView.minimumZoomScale = CGRectGetWidth(self.scrollView.frame) / CGRectGetWidth(self.imageView.frame);
self.scrollView.minimumZoomScale = 1.0;
self.scrollView.maximumZoomScale = 20.0;
[self.scrollView setZoomScale:self.scrollView.minimumZoomScale];
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
return self.imageView;
}