0

我正在创建一个应用程序,其中在UIView子类中我有几个用户选择UIImageView的 'hold UIImage'。我希望能够允许用户保存UIView到 PhotoLibrary,以便将这些UIImageView保存为其中的一种拼贴画UIView。我是否需要一个 UIImageView 来代替UIView允许代码保存整个区域?或者我可以使用UIView吗?

先感谢您!

4

1 回答 1

1

除了存储之外,此功能可以执行您想要的操作:

-(UIImage *)takeScreeShotOfView:(UIView *)view
{
    UIGraphicsBeginImageContext(CGSizeMake(1024, 748));
    CGContextRef context = UIGraphicsGetCurrentContext();
    [view.layer renderInContext:context];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img; 
}
于 2012-02-15T17:56:47.980 回答