简体   繁体   English

如何在 UIActivityViewController 模式中显示文件大小和类型

[英]How to show file size and type in UIActivityViewController modal

To allow the user to download a file, I use the UIActivityViewController provided by Apple.为了允许用户下载文件,我使用了 Apple 提供的UIActivityViewController The following code produces the first screenshot:以下代码生成第一个屏幕截图:

let url: URL = // some url
let activityViewController = UIActivityViewController(activityItems: [url, "A filename"], applicationActivities: nil)
present(activityViewController, animated: true, completion: nil)

上面的代码生成什么

However, it does not show the file type (pdf document) and size, as is shown in the screenshot below.但是,它不显示文件类型(pdf 文档)和大小,如下面的屏幕截图所示。 All functions of the activity view work (downloading, mailing, etc).活动视图的所有功能都起作用(下载、邮寄等)。

Does anyone know how this information can be displayed using a UIActivityViewController ?有谁知道如何使用UIActivityViewController显示这些信息?

如果您下载 PDF 文档,Safari 会显示什么

您可以根据本主题实现功能或尝试为您的共享文件实现activityViewControllerLinkMetadata(_:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM