我希望UIStatusBar
在我的应用程序中设置背景颜色,我希望它匹配的背景颜色,和应用程序UINavigationBar
相同.Facebook
Instagram
我尝试将此函数添加到didFinishLaunchingWithOptions
我的方法中AppDelegate
:
-(void) setStatusBarColour{ #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,self.window.rootViewController.view.frame.size.width, 20)]; view.backgroundColor=[[UIColor lightGrayColor] colorWithAlphaComponent:0.6]; [self.window.rootViewController.view addSubview:view]; } }
它似乎没有工作.
是否有捷径可寻?