iOS移动开发我是程序员;您好程先生;叫我序员就好了iOS开发

设置statusBar,navigationBar,tabBar

2015-01-02  本文已影响430人  ForeverYoung21

设置statusBar,navigationBar,tabBar的颜色

//AppDelegate.m
//设置navigationBarColor

[[UINavigationBar appearance] setTranslucent:YES];
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:128/255.0f green:128/255.0f blue:128/255.0f alpha:1.0]];


// 设置tabBarColor
[[UITabBar appearance] setTranslucent:NO];
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:128/255.0f green:128/255.0f blue:128/255.0f alpha:1.0]];

// 设置status文字颜色

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

此外,需要在.plist文件增加一行:

View controller-based status bar appearance = NO

表示viewController不对status bar进行操作。

上一篇下一篇

猜你喜欢

热点阅读