iOS8中如何將狀態欄的字體顏色改為白色


網上的一些方法在我這行不通,

比如:

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,就是這么簡單。這樣狀態欄的字體就變成白色了!

 

        


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM