//(1)设置要截屏的图片大小
UIGraphicsBeginImageContext(self.view.frame.size);
//(2)对那个视图截图固定大小的图片
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
//(3)获取截图的图片对象
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
//(4)结束绘制图片
UIGraphicsEndImageContext();
//(5)保存到相册
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);