UIDocumentPicker导航栏按钮在iOS 11中隐藏

Ahm*_*zaz 5 swift ios11 uidocumentpickerviewcontroller

我在iOS 11的UIDocumentPicker导航栏中发现了一个问题,完成,取消或编辑按钮是不可见的,当用户触摸它时,它会出现即正常状态下的颜色为白色,即使在更改时也是如此UINavigationBar.appearnce().tintColor,仅颜色触摸后改变了.

在此输入图像描述 在此输入图像描述

Evg*_*rev 3

使用带有黑色的CustomDocumentPickerViewControllerappearanceUINavigationBarUIBarButtonItem

import UIKit

class CustomDocumentPickerViewController: UIDocumentPickerViewController {

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        UINavigationBar.appearance().tintColor = UIColor.black
        UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.black], for: .normal)
    }

    override func viewWillDisappear(_ animated: Bool) {

        UINavigationBar.appearance().tintColor = UIColor.white // your color
        UIBarButtonItem.appearance().setTitleTextAttributes(nil, for: .normal)
        super.viewWillDisappear(animated)

    }

}
Run Code Online (Sandbox Code Playgroud)