swift – UIDocumentPicker导航栏按钮隐藏在iOS 11中
发布时间:2020-12-14 04:44:38 所属栏目:百科 来源:网络整理
导读:我在iOS 11的UIDocumentPicker导航栏中发现问题,完成,取消或编辑按钮是不可见的,当用户触摸它时,即使更改UINavigationBar.appearnce(即使更改UINavigationBar.appearnce时),正常状态下的颜色也是白色. ).tintColor,颜色仅在触摸时改变. 解决方法 对UINavigat
我在iOS 11的UIDocumentPicker导航栏中发现问题,完成,取消或编辑按钮是不可见的,当用户触摸它时,即使更改UINavigationBar.appearnce(即使更改UINavigationBar.appearnce时),正常状态下的颜色也是白色. ).tintColor,颜色仅在触摸时改变.
解决方法
对UINavigationBar和UIBarButtonItem使用带有黑色外观的CustomDocumentPickerViewController
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) } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |