<strong><span style="font-size:24px;">//代码截屏
//(1)设置要截屏 的图片大小
UIGraphicsBeginImageContext(self.view.frame.size);//view.frame.size
//(2)设置对哪个图片截图固定大小的图片
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
//(3)获取截图的图片对象
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
//结束绘制图片
UIGraphicsEndImageContext();
//保存到相册
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);</span></strong>