问题描述
我正在尝试实现共享文件到 Facebook
,邮件
, google驱动程序
和 whatsapp
。
I am trying to implement share multiple file to Facebook
, mail
,google driver
and whatsapp
.
我可以通过 UIDocumentInteractionController
如下代码:
NSString *filePath = [NSString stringWithFormat:@"%@/%@", directory, [fileList objectAtIndex:selectedIndexPath.row]] ;
url = [NSURL fileURLWithPath: filePath] ;
documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
[documentInteractionController setDelegate:self];
documentInteractionController.UTI = @"net.whatsapp.image";
[documentInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];
如何通过 UIDocumentInteractionController
共享多个文件使用 UIActivityViewController
?
How to share multiple file via UIDocumentInteractionController
without using UIActivityViewController
?
如果使用 NSMutableArray
,并添加 url
的多个对象。如何将 NSMutableArray
设置为 UIDocumentInteractionController
?
If use NSMutableArray
, and add multiple object of url
. How to set NSMutableArray
to UIDocumentInteractionController
?
感谢
推荐答案
要共享多个文件,您可以使用UIActivityViewController。
To share multiple files you can use UIActivityViewController.
UIImage *image = [UIImage imageWithCGImage:self.imgView.image.CGImage];
NSArray* dataToShare = @[image, image2, image3]; // Any data you want to share.
UIActivityViewController* activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:dataToShare
applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:nil];
这可能有助于您。
这篇关于如何通过UIDocumentInteractionController共享多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!