我正在创建一个应用程序,在这个应用程序的UIView子类中,我有几个包含用户选择的UIImage的UIImageView。我希望能够允许用户将UIView保存到PhotoLibrary,这样这些UIImageView就会保存为此UIView中的一种拼贴。我需要用UIImageView代替UIView来允许代码保存整个区域吗?或者我可以使用UIView
提前谢谢你!
发布于 2012-02-16 01:56:48
除了存储之外,此函数执行您想要的操作:
-(UIImage *)takeScreeShotOfView:(UIView *)view
{
UIGraphicsBeginImageContext(CGSizeMake(1024, 748));
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}https://stackoverflow.com/questions/9279409
复制相似问题