我的项目中有一个屏幕,其中包含 3 UIScrollView
。这些滚动视图包含一个图像,当我尝试缩放其中一个滚动视图时,我不知道如何缩放,但它们都一起缩放。
这是我的代码:
if ([FrameString isEqualToString:@"LB"]) {
leftButton.hidden = YES;
if (imageLeft == nil) {
imageLeft = [[UIImageView alloc]initWithImage:pickedImage];
}
imageLeft.frame = CGRectMake(0 , 0, imageLeft.frame.size.width/4, imageLeft.frame.size.height/4);
self.Scrollview.maximumZoomScale = 0.9;
self.Scrollview.minimumZoomScale = 0.6;
self.Scrollview.frame = CGRectMake(self.Scrollview.frame.origin.x, self.Scrollview.frame.origin.y, self.Scrollview.frame.size.width, self.Scrollview.frame.size.height);
[self.Scrollview setContentSize:CGSizeMake(imageLeft.frame.size.width, imageLeft.frame.size.height)];
self.Scrollview.clipsToBounds = YES;
self.Scrollview.delegate = self;
[self.Scrollview setScrollEnabled:YES];
[self.Scrollview addSubview:imageLeft];
}
if ([FrameString isEqualToString:@"RDB"]) {
RightDownButton.hidden = YES;
if (RightDown == nil) {
RightDown = [[UIImageView alloc]initWithImage:pickedImage];
}
RightDown.frame = CGRectMake(0 , 0, RightDown.frame.size.width/3, RightDown.frame.size.height/3);
self.scrollview1.maximumZoomScale = 0.9;
self.scrollview1.minimumZoomScale = 0.6;
self.scrollview1.frame = CGRectMake(self.scrollview1.frame.origin.x, self.scrollview1.frame.origin.y, self.scrollview1.frame.size.width, self.scrollview1.frame.size.height);
[self.scrollview1 setContentSize:CGSizeMake(RightDown.frame.size.width, RightDown.frame.size.height)];
self.scrollview1.clipsToBounds = YES;
self.scrollview1.delegate = self;
[self.scrollview1 setScrollEnabled:YES];
[self.scrollview1 addSubview:RightDown];
}
if ([FrameString isEqualToString:@"RUB"]) {
rightUpButton.hidden = YES;
if (RightUp == nil) {
RightUp = [[UIImageView alloc]initWithImage:pickedImage];
}
RightUp.frame = CGRectMake(0 , 0, RightUp.frame.size.width/3, RightUp.frame.size.height/3);
self.scrollview2.maximumZoomScale = 0.9;
self.scrollview2.minimumZoomScale = 0.6;
self.scrollview2.frame = CGRectMake(self.scrollview2.frame.origin.x, self.scrollview2.frame.origin.y, self.scrollview2.frame.size.width, self.scrollview2.frame.size.height);
[self.scrollview2 setContentSize:CGSizeMake(RightUp.frame.size.width, RightUp.frame.size.height)];
self.scrollview2.clipsToBounds = YES;
self.scrollview2.delegate = self;
[self.scrollview2 setScrollEnabled:YES];
[self.scrollview2 addSubview:RightUp];
}