如何通过UIDocumentInteractionController共享多个文件? [英] How to share multiple file via UIDocumentInteractionController?

查看:650
本文介绍了如何通过UIDocumentInteractionController共享多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现共享文件到 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共享多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆