我在ScrollView中有一个图像。它允许捏合和缩放。也可以将ScrollView内的图像旋转到自定义程度。当我这样做时,我会丢失图像的当前缩放级别,并恢复到100%缩放并旋转。有没有办法在旋转图像时保持缩放级别?
我现在正在这样做:
UIScrollView* mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 80,
self.view.frame.size.width, self.view.frame.size.height )];
self.pictureView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Image1.png"]];
[mainScrollView setContentSize:CGSizeMake//(620,612)];
(self.pictureView.frame.size.width, self.pictureView.frame.size.height)];
[mainScrollView addSubview:self.pictureView];
mainScrollView.minimumZoomScale = 0.5;
mainScrollView.maximumZoomScale = 6.0;
mainScrollView.delegate = self;
[mainScrollView setScrollEnabled:YES];
[self.view addSubview:mainScrollView];
[mainScrollView release];
-(void) rotatePicture:(float) value{
self.pictureView.transform = CGAffineTransformMakeRotation(value );
}
答案 0 :(得分:1)
你有没有尝试过:
-(void) rotatePicture:(float) value{
self.pictureView.transform = CGAffineTransform CGAffineTransformRotate (self.pictureView.transform, value);
}
这样做是为了在pictureView上保留缩放变换,并在其上添加一个旋转。