iOS中修改状态栏颜色
修改啟動頁狀態欄顏色
默認顯示黑色,選中TARGETS->General->Deployment Info->Status Bar Style,選擇Light Content則狀態欄顯示白色。
 
修改其他頁面狀態欄顏色
重寫- (UIStatusBarStyle)preferredStatusBarStyle返回所需的狀態欄顏色,比如xxLightContent表示白色。
- (UIStatusBarStyle)preferredStatusBarStyle {return UIStatusBarStyleLightContent; }狀態欄隱藏
1、重寫ViewController1的- (BOOL)prefersStatusBarHidden返回YES,當vc2執行“[self presentViewController:vc1 animated:NO completion:nil];”之前設置“vc1.modalPresentationStyle = UIModalPresentationFullScreen;”,則vc1的狀態欄會隱藏,如果是UIModalPresentationOverFullScreen則不會隱藏。暫時不知道原因。
2、不管是xxFullScreen還是xxOverFullScreen,vc1的UIWindow和vc2的UIWindow是同一個,而且vc1的presentingViewController = UIWindow的根視圖控制器,兩個style的區別是xxFullScreen時通過Lookin看不到vc2的視圖。
3、如果是UIModalPresentationCustom,并且使用自定制的UIPresentationController,然后重寫- (BOOL)shouldRemovePresentersView返回YES,則vc1的狀態欄會隱藏。
總結
以上是生活随笔為你收集整理的iOS中修改状态栏颜色的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 【linux】Rehat/centOS
- 下一篇: Vue 实现前端银行卡隐藏中间的数字,及
