您的位置:首页 > 移动开发 > IOS开发

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

2015-07-28 14:08 911 查看
第一步:

//在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 让图片表现的模式为图片的原始样式 用于去掉系统添加的颜色
if ([[UIDevice currentDevice] systemVersion].floatValue >= 8.0) {
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"title" image:[[UIImage imageNamed:@"Image.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"ImageS.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

}else{

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]];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: