【发布时间】:2011-01-28 08:49:08
【问题描述】:
创建了一个 UIView 并在 UIView 中不断添加和删除小的 snow.png 以模拟下雪的效果。
然后我想将屏幕捕获为图像。
UIGraphicsBeginImageContext(self.uiviewPreview.bounds.size);
[self.uiviewPreview.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
注意:self.uiviewPreview 是 UIView。
但我只能在保存的 jpg 中看到 UIview 中的图像。但是此时所有添加的子视图都没有保存。
我想知道renderInContext是否正确使用
【问题讨论】: