在Targets->General->勾選中Hide status bar
整個(gè)項(xiàng)目隱藏狀態(tài)欄
2267273-1482d4d895e15713.png
2.單個(gè)界面隱藏狀態(tài)欄,例如登錄注冊(cè)頁(yè)面
1.首先在info.plist里面View controller-based status bar appearance 設(shè)置為 NO.
2.在需要調(diào)控狀態(tài)欄的ViewController類中添加以下代碼:
//進(jìn)入時(shí)隱藏
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//隱藏=YES,顯示=NO; Animation:動(dòng)畫效果
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}
//退出時(shí)顯示
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
//隱藏=YES,顯示=NO; Animation:動(dòng)畫效果
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}
3.啟動(dòng)頁(yè)隱藏狀態(tài)欄,進(jìn)入程序后正常顯示狀態(tài)欄
1 .首先在Targets->General->勾選中Hide status bar或者在info.plist里面 Status bar is initially hidden 設(shè)置為 YES
2.在AppDelegate.m中添加代碼
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者