首页 > 代码库 > 【1】【IOS】 截图

【1】【IOS】 截图

1 UIGraphicsBeginImageContext(self.view.bounds.size);// 设置上下文2 3 [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];4 5 UIImage *image=UIGraphicsGetImageFromCurrentImageContext();//从当前上下文中获取image6 7 UIGraphicsEndImageContext();//关闭上下文8 9 UIImageWriteToSavedPhotosAlbum(image,self, nil, nil);//存到相册