尝试更改UIStatusBarStyle
文字颜色的UIImagePickerController
。尝试以下方法:
imagePicker.navigationBar.isTranslucent = false
imagePicker.navigationBar.barTintColor = .darkGray
imagePicker.navigationBar.tintColor = .white
imagePicker.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
This回答显示即使是运营商徽标和UIStatusBarStyle
也会按照指定更改颜色。但它并没有改变。是否还有其他事情可以尝试在UIStatusBarStyle
中更改UIImagePicker
文字颜色?
尝试使用以下代码,该代码适用于其他UIViewController
s
imagePicker.preferredStatusBarStyle = UIStatusBarStyle.lightContent
imagePicker.setNeedsStatusBarAppearanceUpdate()
但不工作..请帮忙。谢谢。
答案 0 :(得分:4)
这是我的代码 - UIImagePIckerController的一个简单子类。
public class ImagePickerController: UIImagePickerController {
override public func viewDidLoad() {
super.viewDidLoad()
}
override public func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override public var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
}
答案 1 :(得分:0)
======= 将UINavigationControllerDelegate,UIImagePickerControllerDelegate添加到您的
=======
=======
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; }
==