3.保存到系统相册
// UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo,nil);//保存到系统相册
//- (void)imageUIImage *)image didFinishSavingWithErrorNSError *)error contextInfovoid *)contextInfo {
// if (error == nil) {
// NSLog(@"保存成功");
// [QYprogressHUD showSuccessWithStatus"截图以保存到相册"];
// } else {
// NSLog(@"失败");
// [QYprogressHUD showErrorWithStatus"截图失败"];
// }
//}
4.知识点补充
4.1首次判断相册权限
PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
if (status == PHAuthorizationStatusNotDetermined) {
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
if (status == PHAuthorizationStatusAuthorized) {//同意
[weakSelf canSaveImg:image];
return ;
}else
{
[QYprogressHUD showInfoWithStatus"未获得相册权限,截屏保存失败"];
return ;
}
}];
} |