如何将UIDocumentPickerViewController与UINavigationController一起使用?

问题描述 投票:0回答:1

我正在尝试将UIDocumentPickerViewController推入UINavigationController的堆栈,但是,这将导致看起来像两个导航栏。顶部栏是导航控制器的普通导航栏。在下面的栏包含文档选择器的“取消”和“完成”按钮。单击“取消”或“完成”按钮可关闭整个视图。

问题:如何正确地将UIDocumentPickerViewController包含在导航控制器的堆栈中,以使“取消”和“完成”按钮出现在导航栏中,并使上一个和下一个视图控制器出现?

ios uinavigationcontroller uidocumentpickerviewcontroller
1个回答
0
投票

我相信您应该展示控制器,而不是将其推入堆栈?

func presentPicker() {

    var documentPicker: UIDocumentPickerViewController = UIDocumentPickerViewController(documentTypes: ["public.text"], inMode: UIDocumentPickerMode.Import)
    documentPicker.delegate = self
    documentPicker.modalPresentationStyle = UIModalPresentationStyle.FullScreen
    self.presentViewController(documentPicker, animated: true, completion: nil)

}
© www.soinside.com 2019 - 2024. All rights reserved.