NavBar和TabBar簡單設定
// 設定navbar和tabbar是否有透明度
self.navigationController.navigationBar.translucent = YES/NO;
self.tabBarController.tabBar.translucent = YES/NO;
NavBar-導航條
全域性:
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:200/255.0f green:38/255.0f blue:39/255.0f alpha:1.0f]]; // 設定導航條背景顏色
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]}]; // 設定導航條字型大小顏色
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; // 設定返回按鈕影象字型顏色
TabBar
// 去掉tabbar的黑線
[[UITabBar appearance] setShadowImage:[[UIImage alloc]init]];
[[UITabBar appearance] setBackgroundImage:[[UIImage alloc]init]];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor grayColor], NSFontAttributeName:[UIFont systemFontOfSize:12]} forState:UIControlStateNormal]; // 設定tabbar的正常狀態的字型顏色大小
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:12]} forState:UIControlStateSelected]; // 設定tabbar選中狀態的字型顏色大小
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:200/255.0f green:38/255.0f blue:39/255.0f alpha:1.0f]]; // 設定tabbar背景顏色