我有 uiview,我想将该视图转换为运行良好的图像,但是当我按下 iphone 的主页按钮并再次运行应用程序时,图像会放大。这是我将视图转换为图像的代码。
- (UIImage *)captureView {
CGRect rect = [myview bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[myview.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
checkImage.image = [self captureView];