如何写animationGIF到iOS相机卷?

你如何写一个animationGIF的iOS相机卷? 我知道相册应用程序不能播放animation,但是例如,我应该可以在发送电子邮件时将其导入。

我试过了:

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

但是,这似乎将其转换为JPG格式。

创build一个ALAssetLibrary实例。 使用此方法与您的NSDatawriteImageDataToSavedPhotosAlbum:metadata:completionBlock:

参考

你可以像这样在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];