保存图片到本地相册

网页上的 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!!!


你可能感兴趣的:(保存图片到本地相册)