如何将动画GIF写入iOS相机胶卷?我知道照片库应用程序无法播放动画,但例如我应该能够在发送电子邮件等时导入它。
我试过了:
UIImageWriteToSavedPhotosAlbum([UIImage imageWithData:self.imageData], nil, nil, nil);
但这似乎将其转换为jpg。
答案 0 :(得分:2)
创建ALAssetLibrary
个实例。将此方法与NSData
:writeImageDataToSavedPhotosAlbum:metadata:completionBlock:
答案 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];