您可以通过制作有关 all 的超级视图的屏幕截图来做到这一点UIImageView
。我为此编写了一个方法:(确保您将您的添加UIImageViews
到同一个视图中。例如:
[self.view addSubview: image1];
[self.view addSubview: image2];
[self.view addSubview: image3];
[self.view addSubview: image4];
self.view
然后对)进行截图
+ (UIImage*) screenShotTheArea:(CGRect)area inView:(UIView*)view{
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
UIGraphicsBeginImageContextWithOptions(CGSizeMake(area.size.width, area.size.height), NO, [UIScreen mainScreen].scale);
else
UIGraphicsBeginImageContext(view.bounds.size);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(c, -area.origin.x, -area.origin.y);
[view.layer renderInContext:c];
UIImage* thePrintScreen = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return thePrintScreen;
}