【问题标题】:Alternatives for UIDocumentMenuViewController in iOS 11iOS 11 中 UIDocumentMenuViewController 的替代品
【发布时间】:2018-01-10 15:16:19
【问题描述】:

是否可以在 iOS 11 中实现 UIDocumentMenuViewController 的外观(在 iOS 11 中已弃用)?我在 iOS 11 中找到的最接近的是 UIDocumentPickerViewController,但这不允许我显示文档提供程序的菜单,而是以模式方式显示最近使用的文档提供程序的全屏。

如果没有与 UIDocumentMenuViewController 相同的替代品,是否至少有一种方法可以强制 UIDocumentPickerViewController 直接转到“位置”而不是显示最近使用的文档提供程序?

期望的结果:

【问题讨论】:

  • UIDocumenPickerViewController 在 iOS 11 中不再需要 UIDocumentMenuViewController。用户可以从选择器视图中选择一个位置,因此菜单不像在 iOS 10 中那样有用。
  • 据我所知是不可能的。 Apple 似乎正在推动 UIDocumenPickerViewController 提供的新 UI。
  • 谢谢@rmaddy。知道是否可以让 UIDocumentPickerViewController 直接进入“浏览”标签而不是“最近”标签?
  • 谢谢@mattsven。是否知道遍历文档提供程序并创建自定义文档选择器或自定义 Apple 提供的选择器是否可行?
  • 谢谢@mattsven。这是完全有道理的,但想确保我在将其标记为不可行之前尝试了所有方法,并且您的反馈确实有助于确认我的假设。我很感激。

标签: swift ios11 uidocumentpickerviewcontroller


【解决方案1】:

您可以将 UIAlertController 与 UIAlertControllerStyle.ActionSheet 一起使用。我有 Xamarin.ios 代码。

var okCancelAlertController = UIAlertController.Create("", "Choose", 
UIAlertControllerStyle.ActionSheet);
//Add Actions
okCancelAlertController.AddAction(UIAlertAction.Create("iCloud", UIAlertActionStyle.Default, (s) => { }));
okCancelAlertController.AddAction(UIAlertAction.Create("Photos", UIAlertActionStyle.Default, (s) => { }));
okCancelAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (s) => { }));
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(okCancelAlertController, true, null);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-18
    • 2012-03-04
    • 2018-06-27
    • 2020-03-18
    相关资源
    最近更新 更多