gpt4 book ai didi

ios - 在 iOS 中的 Instagram 上分享多张图片

转载 作者:行者123 更新时间:2023-11-29 10:33:35 25 4
gpt4 key购买 nike

我正在开发一个应用程序,我们需要在其中一次在 instagram 上共享多个图像。我搜索了很多但找不到任何解决方案。我正在使用代码在 Instagram 上分享单张图片:

 NSString *imagePath = [NSString stringWithFormat:@"%@/image.igo",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject]];
[[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil];
UIImage *sharingImg = (UIImage *)[self.watermarkedImagesArr objectAtIndex:0];
sharingImg =[self imageWithImage:sharingImg scaledToSize:CGSizeMake(sharingImg.size.width/4, sharingImg.size.height/4)];
[UIImagePNGRepresentation(sharingImg) writeToFile:imagePath atomically:YES];
NSURL *instagramURL = [NSURL fileURLWithPath:imagePath];

_docController = [UIDocumentInteractionController interactionControllerWithURL:instagramURL];
_docController.delegate = self;
_docController.UTI = @"com.instagram.exclusivegram";
self.docController.annotation = [NSDictionary dictionaryWithObject:@"Photo watermark app" forKey:@"InstagramCaption"];
[self.docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

如有任何帮助,我们将不胜感激。提前致谢。

最佳答案

我认为这段代码可以帮到你

NSArray* arryOfImgs = @[image1, image2, image3]; 
UIActivityViewController* activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:arryOfImgs
applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:^{

}];

关于ios - 在 iOS 中的 Instagram 上分享多张图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28230263/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com