如何更改 UIImagePickerController 视图的 UIStatusBarStyle 文本颜色
How to change UIStatusBarStyle text color of a UIImagePickerController view
正在尝试更改 UIStatusBarStyle
的 UIImagePickerController
文本颜色。尝试了以下方法:
imagePicker.navigationBar.isTranslucent = false
imagePicker.navigationBar.barTintColor = .darkGray
imagePicker.navigationBar.tintColor = .white
imagePicker.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
This 答案显示,即使运营商徽标和 UIStatusBarStyle
也会按指定更改颜色。但它并没有改变。是否有任何其他方法可以尝试使 UIImagePicker
中的 UIStatusBarStyle
文本颜色发生变化?
尝试了以下适用于其他 UIViewController
的代码
imagePicker.preferredStatusBarStyle = UIStatusBarStyle.lightContent
imagePicker.setNeedsStatusBarAppearanceUpdate()
但不工作..请帮助。谢谢。
这是我的代码 - UIImagePIckerController 的一个简单子类。
public class ImagePickerController: UIImagePickerController {
override public func viewDidLoad() {
super.viewDidLoad()
}
override public func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override public var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
}
=======
将 UINavigationControllerDelegate、UIImagePickerControllerDelegate 添加到您的
@interface yourController ()<>
=======
imagePickerController.delegate = 自我;
=======
-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
======
正在尝试更改 UIStatusBarStyle
的 UIImagePickerController
文本颜色。尝试了以下方法:
imagePicker.navigationBar.isTranslucent = false
imagePicker.navigationBar.barTintColor = .darkGray
imagePicker.navigationBar.tintColor = .white
imagePicker.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
This 答案显示,即使运营商徽标和 UIStatusBarStyle
也会按指定更改颜色。但它并没有改变。是否有任何其他方法可以尝试使 UIImagePicker
中的 UIStatusBarStyle
文本颜色发生变化?
尝试了以下适用于其他 UIViewController
的代码
imagePicker.preferredStatusBarStyle = UIStatusBarStyle.lightContent
imagePicker.setNeedsStatusBarAppearanceUpdate()
但不工作..请帮助。谢谢。
这是我的代码 - UIImagePIckerController 的一个简单子类。
public class ImagePickerController: UIImagePickerController {
override public func viewDidLoad() {
super.viewDidLoad()
}
override public func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override public var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}
}
======= 将 UINavigationControllerDelegate、UIImagePickerControllerDelegate 添加到您的
@interface yourController ()<>
=======
imagePickerController.delegate = 自我;
=======
-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; }
======