![](/img/trans.png)
[英]How to rotate/scale/change coordinates of SCNNode programatically in ios
[英]How to change zoom scale for imageview programatically?
我在subview(UIView)中有2个ImageView。 我将前景图像的缩放比例设置为0.3点。
self.superImage_View.transform =CGAffineTransformMakeScale(1.3,1.3);
之后,当我单击调整大小按钮时,我再次更改前景图像的缩放比例。
self.superImage_View.transform =CGAffineTransformMakeScale(1.0,1.0);
我也想将背景图像的缩放比例更改为0.3点。 我在背景图像上设置了捏手势以进行放大/缩小。但是问题是我无法找到背景图像视图的比例。 此外,如果在单击调整大小按钮后,背景图像视图是由用户放大/缩小的,则我无法将缩放比例缩小0.3个缩放比例。 我希望两个图像都具有相同的缩放比例,而不管背景图像视图是否放大/缩小。 请给我任何解决方案。
两件事情。 您需要在UIScrollView内添加UIImageView。
缩放仅在实现viewForZoomingInScrollView:委托回调时有效。
-(UIView *) viewForZoomingInScrollView:(UIScrollView *)inScroll {
return imageView;
}
您可以在zoomView内添加具有缩放比例的imageView,如下所示:
UIImageView *tempImage = [[UIImageView alloc]initWithImage:[UIImage imageWithData:data]];
self.imageView = tempImage;
scrollView.contentSize = imageView.frame.size;
scrollView.maximumZoomScale = yourMaximumScale;
scrollView.minimumZoomScale = yourMinimumScale;
scrollView.clipsToBounds = YES;
scrollView.delegate = self;
[scrollView addSubview:imageView];
scrollView.zoomScale = yourScale;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.