iOS Status Bar Text Color

2018-12-20  本文已影响9人  VincentZhou

iOS 状态栏颜色设置

  1. Add a key "" in your Info.plist file
set "View controller-based status bar appearance" to YES
  1. Override this method in each of your ViewController
override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}
BTW:

When you are in Navigation controller that will not get called. You should Override navagation controller's "preferredStatusBarStyle",

extension UINavigationController {
   open override var preferredStatusBarStyle: UIStatusBarStyle {
      return topViewController?.preferredStatusBarStyle ?? .default
   }
}
上一篇 下一篇

猜你喜欢

热点阅读