UIImageView
我用这种方法创建了一个底部一层和一层覆盖的双层:
UIImage *bottomImage = self.imageView.image;
UIImage *image = self.urlFoto.image;
CGSize newSize = CGSizeMake(640, 640);
UIGraphicsBeginImageContext( newSize );
[bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height) blendMode:kCGBlendModeNormal alpha:1.0];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
在此之后,我添加了一种使用捏合手势调整图像大小的方法:
- (IBAction)scaleImage:(UIPinchGestureRecognizer *)recognizer {
recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
recognizer.scale = 1;
}
但是当我将照片保存在照片库中时,我无法获得叠加层的当前大小,并且在叠加层(图像)上看到相同的大小 640,640,我认为错过的代码在这里:
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height) blendMode:kCGBlendModeNormal alpha:1.0];
在任何知道正确的方法来获得捏后CGRectMake(0,0,newSize.width,newSize.height)
的当前大小?UIImageView