I'm creating an app where within a UIView
subclass I have several UIImageView
's holding UIImage
's that the user has picked. I want to be able to allow the user to save the UIView
to the PhotoLibrary so that those UIImageView
's are saved as a sort of collage within this UIView
. Would I need to have a UIImageView in place of the UIView
to allow the code to save the whole area? or would I be able to use the UIView
?
Thank you in advance!
This function does what you want except storage:
-(UIImage *)takeScreeShotOfView:(UIView *)view
{
UIGraphicsBeginImageContext(CGSizeMake(1024, 748));
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}