畅畅的烧烤店

iOS设置导航与其标题的颜色及字体大小和系统默认TabBar的相关设置与使用方法

第一步:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//在info.plist中添加一个字段:view controller -base status bar 设置为NO;
//导航颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor XXXX]];
[[UITableViewCell appearance] setBackgroundColor:[UIColor XXXX]];
//设置状态栏(信号区)白色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
//默认带有一定透明效果,可以使用以下方法去除系统效果
[navigationController.navigationBar setTranslucent:NO];
//更改导航标题字体大小与颜色要在第一级页面设置 如下
// 设置导航默认标题的颜色及字体大小
self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeTextColor: [UIColor whiteColor], UITextAttributeFont:[UIFont boldSystemFontOfSize:18]};

第二步:

//UIImageRenderingModeAlwaysOriginal 让图片表现的模式为图片的原始样式 用于去掉系统添加的颜色
self.tabBarController.tabBarItem.title = @"title";
if ([[UIDevice currentDevice] systemVersion].floatValue >= 7.0) {

[self.tabBarController.tabBarItem setFinishedSelectedImage:[[UIImage imageNamed:@"Image.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] withFinishedUnselectedImage:[[UIImage imageNamed:@"ImageS.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
}else{
[self.tabBarController.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"Image.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ImageS.png"]];
}
//tabbar颜色 用于更改字体颜色
[self.tabBarController.tabBar setTintColor:[UIColor XXXX]];

Demo地址:
This is https://github.com/wly314/HappyTravel.
欢迎交流。