0

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

我试过了:

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

但这似乎将其转换为jpg。

4

2 回答 2

2

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

参考

于 2013-07-06T04:44:54.690 回答
-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];
于 2013-07-06T04:45:29.840 回答