在iOS 13中,在自定义导航栏外观方面,有些东西似乎发生了变化。我想定制一个导航栏的 UIImagePickerController
. 根据iOS 13指南,改变现有导航栏的代码(在这种情况下,改变导航栏的 UIImagePickerController
导航栏背景颜色为红色)将是。
let imagePickerViewController = UIImagePickerController()
let barAppearance = UINavigationBarAppearance()
barAppearance.configureWithDefaultBackground()
barAppearance.backgroundColor = .red
imagePickerViewController.navigationBar.standardAppearance = barAppearance
imagePickerViewController.navigationBar.scrollEdgeAppearance = barAppearance
不幸的是,这样做是行不通的。在一般情况下,设置 imagePickerViewController.navigationBar
外观不影响所呈现的 UIImagePickerController
.
唯一有效的是改变了所有的 UINavigationBars
像这样。
UINavigationBar.appearance().tintColor = .red
但这并不允许个人定制,也不允许用你自己的导航栏来扩展。UIBarButtonItems
和其他导航栏元素。
我知道在StackOverflow上有一些关于这个话题的问题,但是没有一个问题有一个有效的答案,也没有一个问题讨论苹果是否在一般的可定制性方面做了任何改变。UIImagePickerController
. 因此,这里是我的问题。
UIImagePickerController
在iOS 13中?UIImagePickerController
在iOS 13中?我也试过,但只 UINavigationBar.appearance().tintColor = .red
就像你说的那样
部分 UIImagePickerController
在一个单独的进程上运行 (_UIRemoteView
),可能是这个原因?