UINavigationBar导航栏相关设置
设置导航颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:1]];
[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)];
设置导航文字颜色
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
设置导航背景
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bg.png"] forBarMetrics:UIBarMetricsDefault];
设置多个导航按钮
UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:nil];
UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:nil];
NSArray *actionButtonItems = @[shareItem, cameraItem];
self.navigationItem.rightBarButtonItems = actionButtonItems;
设置导航字体
NSShadow *shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
shadow.shadowOffset = CGSizeMake(0, 1);
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];
说法二:
方法1
在导航向上添加一个titleView,可以使用一个label,再设置label的背景颜色透明,字体什么的设置就很简单了。
//自定义标题视图
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
titleLabel.backgroundColor = [UIColor grayColor];
titleLabel.font = [UIFont boldSystemFontOfSize:20];
titleLabel.textColor = [UIColor greenColor];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.text = @"新闻";
self.navigationItem.titleView = titleLabel;
方法2
// 设置 标题的颜色和字号
[self.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:2
0],NSForegroundColorAttributeName:[UIColor whiteColor]}];
self.navigationBar.barTintColor =[UIColor whiteColor]];
设置tabbar的背景颜色
self.tabBar.barTintColor = [UIColor whiteColor];
UINavigationBar导航栏相关设置的更多相关文章
- 导航栏视图设置 tabbleView 是设置总背景图
//导航栏视图设置 tabbleView 是设置总背景图 //默认的时白色半透明(有点灰的感觉), UIBarStyleBlack,UIBarStyleBlackTranslucent ,UIBarS ...
- iOS状态栏、导航栏的设置
简单的参考 1.状态栏(statusBar) 默认:黑色 改变为白色: 1.1 第一步: info.plist中添加View controller-based status bar appearanc ...
- IOS 导航栏属性设置
IOS 7 以上系统导航栏: [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; // 返回按钮颜色 [UINaviga ...
- UINavigationController导航栏按钮设置
UINavigationController常见属性 1.一般情况下,导航栏上面显示什么内容,由当前栈顶控制器的navigationItem属性决定 * navigationItem.title : ...
- Swift 导航栏设置
let width = UIScreen.mainScreen().bounds.size.width let height = UIScreen.mainScreen().bounds.size.h ...
- App开发流程之状态栏和导航栏
记录状态栏和导航栏的设置和控制,统一在基类视图控制器中完成. 状态栏. 状态栏高度为20,iOS7以后背景完全透明. 样式枚举如下: typedef NS_ENUM(NSInteger, UIStat ...
- iOS系统中导航栏的转场解决方案与最佳实践
背景 目前,开源社区和业界内已经存在一些 iOS 导航栏转场的解决方案,但对于历史包袱沉重的美团 App 而言,这些解决方案并不完美.有的方案不能满足复杂的页面跳转场景,有的方案迁移成本较大,为此我们 ...
- 【转】【iOS】导航栏那些事儿
原文网址:http://www.jianshu.com/p/f797793d683f 参考文章 navigationItem UINavigationItem UINavigationBar UIBa ...
- 小程序--改变子级别页面导航栏信息 / navigationBarTitleText
微信小程序在公共文件app.json中设置了导航栏相关样式如下: 其中 navigationBarTitleText 为设置导航栏名称,若是想子级页面和父页面的header页面不同,则在子级文件中新 ...
随机推荐
- poj 3648 2-SAT问题
思路:将每对夫妻看成是对立状态,每个不正常关系都是一个矛盾,按2-SAT的方式建边.最后建一条新娘到新郎的边.具体看注释 #include<iostream> #include<cs ...
- HDOJ2028Lowest Common Multiple Plus
Lowest Common Multiple Plus Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (J ...
- Android 分析工具 APKAnalyser
APKAnalyser 是 Android 静态,虚拟分析工具,用来测试和验证 Android 应用的开发工作.ApkAnalyser 是个完整的工具链,可以修改二进制应用.用户可以改装,安装,运行, ...
- 文件流操作(FileStream,StreamReader,StreamWriter)
大文件拷贝: /// <summary> /// 大文件拷贝 /// </summary> /// <param name="sSource"> ...
- Php的安装与配置
PHP的安装 php不需要安装,只是一个软件包,在Apache启动的过程中加载即可 PHP的配置 php是一个软件包,只需要在apache启动过程中加载即可,Php对于apache是一个功能模块. 测 ...
- 找个输入IPoint在某个FeatureClass上距离最近的要素
/// <summary> /// 得到输入点在输入图层上的最近点 /// </summary> /// <param name="randomPoints ...
- [转]C#发送Email邮件 (实例:QQ邮箱和Gmail邮箱)
下面用到的邮件账号和密码都不是真实的,需要测试就换成自己的邮件账号. 需要引用:using System.Net.Mail;using System.Text;using System.Net; 程序 ...
- jQuery父级以及同级元素查找介绍
父级以及同级元素的查找在使用过程中还是蛮频繁的,下面为大家介绍下jQuery是如何实现的,感兴趣的朋友可以参考下: jQuery.parent(expr) 找父亲节点,可以传入expr进行过滤,比如$ ...
- ECMAScript 5.1 Edition DOC 学习笔记
1.类型 string number object boolean null undefined symbol (es6) attention : (typeof null) 值为 'object', ...
- Axure RP 各个版本中文版 汉化包 破解版 下载地址及注册码
导读:Axure RP Pro是一个产品经理必备的交互原型设计工具,能够高效率制作产品原型,快速绘制线框图.流程图.网站架构图.示意图.HTML模版等.Axure RP已被一些大公司采用.Axure ...