您的位置:首页 > 移动开发 > IOS开发

IOS开发——保存图片到相册

2014-11-09 14:30 387 查看
IOS开发——保存图片到相册

//将UIImage保存到本地相册
- (void)saveImageToAlbum{
UIImage *image = _imgView.image;
  UIImageWriteToSavedPhotosAlbum(image, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), nil);
}

//判断是否保存成功
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
NSString *message = @"保存失败";
if (!error) {
message = @"保存成功";
}else{
message = [error description];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:message message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: