ios保存动态图片

 
UIImageWriteToSavedPhotosAlbum([UIImage imageWithData:ImageData], self,                                     @selector(image:didFinishSavingWithError:contextInfo:), nil);
 
 
 

但是当图片是Gif格式时,这种方法就不行了,因为UIImage是不支持Gif格式的,

这时我们只好使用以下方法:

 
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
         [library writeImageDataToSavedPhotosAlbum:ImageData metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) {
             // Continue as normal...
         }];
         [library release];
 
 
 
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
         [library writeImageDataToSavedPhotosAlbum:ImageData metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) {
             // Continue as normal...
         }];
         [library release];

猜你喜欢

转载自zhangmingwei.iteye.com/blog/2051389