網上的一些方法在我這行不通,
比如:
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
1、Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file. 2、In the viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate]; 3、Add the following method: -(UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent; }
最后終於有個方法OK
1、設置Info.plist中的View controller-based status bar appearance為YES
2、然后在AppDelegate.swift中的
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool
方法中加入:
UINavigationBar.appearance().barStyle = UIBarStyle.Black
OK,就是這么簡單。這樣狀態欄的字體就變成白色了!