【发布时间】:2017-08-23 09:36:07
【问题描述】:
我正在开发一个应用程序,并希望使用 uiactivityviewcontroller 共享保存在我的文档目录中的图像视频和其他文件。图像和文件共享工作正常。 图片分享代码
var textToShare : Any!
textToShare = UIImage(data:data)//data of an image
存储在文档目录中的其他文件的代码。
var textToShare : Any!
textToShare = url//url of file saved into document directory
但我不知道如何分享视频。在这之后我使用以下代码来使用activityviewcontroller。
let activityViewController = UIActivityViewController(activityItems: [textToShare], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
// exclude some activity types from the list (optional)
activityViewController.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook ]
// present the view controller
self.present(activityViewController, animated: true, completion: nil)
【问题讨论】:
标签: swift3 uiactivityviewcontroller