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]];
//在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]];
相关文章推荐
- iOS开发的一些奇巧淫技
- iOS地图定位使用几个小功能(刚刚)
- 【iOS发展-44】通过案例谈iOS重构:合并、格式化输出、宏观变量、使用数组来存储数据字典,而且使用plist最终的知识
- ios--c DAY_1
- Nagios 监控
- iOS调用系统发短信功能详解(刚刚)
- iOS Animation详解
- iOS开发使用代码创建一个Label控件
- ios开发—利用xcode tabbed模块快速开发标签栏应用
- iOS 数据请求 GZip数据压缩和解压缩问题
- IOS NSString比较,截取,NSLog,NSRang,isEqualToString,stringWithFormat
- iOS utf-8和 url encode
- js调用oc方法(ios自学笔记)
- iOS开发系列–音频播放、录音、视频播放、拍照、视频录制
- ios开发特殊符号大全:字符+键盘符...
- ios蓝牙使用总结
- iOS——转场动画(CATransition)
- Xcode7.0免费真机IOS调试解决方案教程
- ios 文字渐变色实现的两种方法
- iOS多线程的初步研究(四)-- NSTimer