ios 設置狀態欄背景顏色 – iPhone手機開發技術文章 iPhone軟體開發教學課程

第一種方法:

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;

self.navigationController.navigationBar.tintColor = [UIColor blackColor];

if (is_ios_7_Later) {

self.view.window.frame = CGRectMake(0, 20,
self.view.window.frame.size.width, self.view.window.frame.size.height – 20);

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];

}

第二種方法(這方法比較簡單):

UIView *statusBarView=[[UIView
alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];

statusBarView.backgroundColor=[UIColor
blackColor];

[self.view
addSubview:statusBarView];

[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent
animated:NO];

發佈留言