How to write animated GIF to iOS camera roll?

后端 未结 2 1114
有刺的猬
有刺的猬 2021-01-17 03:56

How do you write an animated GIF to the iOS camera roll? I understand that the photo gallery app is not able to play animations, but for example I should be able to import i

相关标签:
2条回答
  • 2021-01-17 04:46

    You can use gif in iOS email attachment like this.

    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];
    
    0 讨论(0)
  • 2021-01-17 04:50

    Create an ALAssetLibrary instance. Use this method with your NSData: writeImageDataToSavedPhotosAlbum:metadata:completionBlock:

    Reference

    0 讨论(0)
提交回复
热议问题