【发布时间】:2017-09-22 11:23:08
【问题描述】:
我有一个 viewA,它包含一个 GLKView 和作为 UIImageView 的子视图。如何将 viewA 的快照保存到图像?我正在使用此代码,适用于任何类型的视图,但 GLKView
- (UIImage *) takeSnapshot
{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, [[UIScreen mainScreen] scale]);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
【问题讨论】: