1.UIStatusBarStyleDefault 默認(rèn)是黑色 UIStatusBarStyleLightContent (Light content)是白色
2.如果app的導(dǎo)航條的文字顏色是統(tǒng)一的黑色,iOS status文字顏色是黑色,不需要添加任何代碼和設(shè)置。
如果app導(dǎo)航條需求改成白色需要設(shè)置View controller-based status bar appearance = NO ,還需要appdelegate里面設(shè)置
代碼[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent(蘋果推薦使用重寫viewcontroller來修改設(shè)置導(dǎo)航條的顏色)
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}


2-1:
如果想將狀態(tài)欄和導(dǎo)航欄字體全變?yōu)榘咨?這樣就行
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
plist 是默認(rèn)可不添加/View controller-based status bar appearance = YES
3.如果app viewcontroller頁面導(dǎo)航條文字顏色不一樣,就需要使用viewcontroller自己來控制每一個頁面的顏色黑色還是白色
默認(rèn)是View controller-based status bar appearance = YES 如果設(shè)置NO viewController 重寫方法是不會執(zhí)行的。相反設(shè)置稱YES 會執(zhí)行頁面重寫方法。

4.如果uinavigation是rootview 需要navigation去重寫方法,有時我們的當(dāng)前顯示的UIViewController可能有多個childViewController,重寫當(dāng)前UIViewController的childViewControllerForStatusBarStyle方法,讓childViewController的preferredStatusBarStyle生效(當(dāng)前UIViewController的preferredStatusBarStyle就不會被調(diào)用了)。

5.setTintColor和setBarTintColor . ios7.0之后 please use -barTintColor.
6.設(shè)置導(dǎo)航條和狀態(tài)條看起來是一體的背景。
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"image01"] forBarMetrics:UIBarMetricsDefault];
如果設(shè)置了這個看起來一體的背景,就不能更改狀態(tài)欄的背景了。

7.UIView *statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, -20, self.view.bounds.size.width, 20)];
statusBarView.backgroundColor = [UIColor greenColor];
[self.navigationController.navigationBar addSubview:statusBarView];

這里是更改狀態(tài)欄的顏色
8.看起來是透明的可以這么寫,下面是一個viewcontroller的背景圖。navigationbar設(shè)置一個nil image
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]
self.navigationController.navigationBar.shadowImage = [UIImage new];

參考鏈接:
http://blog.csdn.net/wangqiuwei07/article/details/53220702
http://blog.csdn.net/u011118092/article/details/54907323
http://doc.okbase.net/shede333/archive/94517.html
http://www.itdecent.cn/p/63f758796438