您的位置:首页 > 其它

保存图片到本地相册

2015-12-04 17:45 274 查看
网页上的 Image 长按保存到本地相册。。。

UILongPressGestureRecognizer *press = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressAction:)];

[self.myView addGestureRecognizer:press];

- (void)longPressAction:(UILongPressGestureRecognizer *)sender

{

NSLog(@"长按...");

/*

**就这么 简单的一句话, 没错 就一句!!!

*/

UIImageWriteToSavedPhotosAlbum(self.imageView.image, self, @selector(imageSaveToPhotosAlbum:didFinishiSavingWithError:contextInfo:), nil);

}

//实现上述方法(不对 是对保存成功或者失败 标记)

- (void)imageSaveToPhotosAlbum:(UIImage *)image didFinishiSavingWithError:(NSError *) error contextInfo:(void *)contextInfo

{

NSString *message = @"呵呵";

if (!error) {

message = @"保存成功";

} else {

NSLog(@"保存失败");

}

NSLog(@"message is ---> %@", message);

}

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