如何进行自定义提醒操作表?

时间:2017-11-08 08:18:47

标签: ios iphone swift

我有一个邮件API,可以发送一些信息和文档。我只发送文件文件,但我想在UIDocumentPickerView中再显示一个选项。

如何显示“文档,照片,相机等”列表。与图像相同的选择器?

我的代码是:

@available(iOS 8.0, *)
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
    let urlData = url as URL
    let theFile = urlData.absoluteString
    self.documentName.text = "\(theFileName)"
}

@available(iOS 8.0, *)
public func documentMenu(_ documentMenu:     UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {

    documentPicker.delegate = self
    present(documentPicker, animated: true, completion: nil)

}

func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
    dismiss(animated: true, completion: nil)
}

func mySpecialFunction(){
    let importMenu = UIDocumentMenuViewController(documentTypes: [String(kUTTypePDF)], in: .import)
    importMenu.delegate = self
    importMenu.modalPresentationStyle = .formSheet
    self.present(importMenu, animated: true, completion: nil)

}

1 个答案:

答案 0 :(得分:0)

这是一个自定义组件,您需要自己编写代码,以便在GitHub或CocoaControls上找到类似内容。