【问题标题】:UIDocumentMenuViewController buttons not doing anythingUIDocumentMenuViewController 按钮不做任何事情
【发布时间】:2014-10-07 13:52:25
【问题描述】:

所以我正在测试 Apple 的新 Document Provider 扩展。我正在尝试打开一个 UIDocumentMenuViewController ,并且该部分正在工作。但是,当我尝试单击它呈现的其中一个项目时,它只会取消操作表。即使我单击默认情况下存在的 iCloud 项目,也会发生这种情况。我展示控制器的代码如下:

let type_data = kUTTypeData.__conversion()
let documentMenuViewController = UIDocumentMenuViewController(documentTypes:   [type_data], inMode: UIDocumentPickerMode.Import)
navigationController.presentViewController(documentMenuViewController, animated: true, completion: nil)

有人知道为什么会这样吗?

【问题讨论】:

  • 没有实现委托方法...哎呀

标签: ios button document ios8 ios-app-extension


【解决方案1】:

您需要在UIDocumentMenuViewController 上设置委托。然后实现-documentMenu:didPickDocumentPicker:委托方法。然后您可以继续展示被选中的documentPicker

func documentMenu(documentMenu: UIDocumentMenuViewController!, didPickDocumentPicker documentPicker: UIDocumentPickerViewController!) {
    documentPicker.delegate = self
    self.presentViewController(documentPicker, animated: true, completion: nil)
}

这个here in Apple's guide有一个简单的例子。

【讨论】:

    【解决方案2】:

    查看 NewBox Apple 示例代码,您会看到缺少的步骤。由于 iOS 8 仍处于保密协议下,因此无法在此处提供实际答案。

    【讨论】:

      猜你喜欢
      • 2017-12-31
      • 1970-01-01
      • 2016-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-13
      • 1970-01-01
      相关资源
      最近更新 更多