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