如何将动画GIF写入iOS相机胶卷?

时间:2013-07-06 03:57:57

标签: iphone ios ios6

如何将动画GIF写入iOS相机胶卷?我知道照片库应用程序无法播放动画,但例如我应该能够在发送电子邮件等时导入它。

我试过了:

UIImageWriteToSavedPhotosAlbum([UIImage imageWithData:self.imageData], nil, nil, nil);

但这似乎将其转换为jpg。

2 个答案:

答案 0 :(得分:2)

创建ALAssetLibrary个实例。将此方法与NSDatawriteImageDataToSavedPhotosAlbum:metadata:completionBlock:

一起使用

Reference

答案 1 :(得分:-3)

您可以在iOS电子邮件附件中使用gif。

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@""];

// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"Your image name" ofType:@"gif"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/gif" fileName:@"photo name"];

NSString *emailBody = @"";
[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];
[picker release];