navigationbar的一些设置记录
1.设置navigationbar背景颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
PS:如果颜色不对,可能是因为默认的半透明玻璃效果导致的,要关闭使用
self.navigationController.navigationBar.translucent = NO;
再PS:如果修改了颜色一点反应都没,则需要隐藏/显示
2.设置按钮颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
3.设置标题颜色及大小
方法1:
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 144)];
title.text = @"帮助";
title.textAlignment = NSTextAlignmentCenter;
title.textColor = [UIColor whiteColor];
title.font = [UIFont systemFontOfSize:20];
self.navigationItem.titleView = title;
方法2:
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor,[UIColor colorWithRed:0 green:0.7 blue:0.8 alpha:1], UITextAttributeTextShadowColor,[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset,[UIFont fontWithName:@"Arial-Bold" size:0.0],UITextAttributeFont,nil]];
4.navigationbar默认高度为44
最新文章
- SSH框架简化(struts2+spring+hibernate)
- EF架构~数据分批批量提交
- WEB前端知识在乱花渐欲迷人眼的当下,如何分清主次和学习优先级呢?
- Cocos2dx淌坑日记:粒子系统PositionType的正确使用
- Linux常用指令---$PATH (环境变量)
- ACM题目————二叉树的遍历
- IOS 支付宝、微信回调传值给H5网页
- (原)工具篇-利用fis压缩项目
- Session小案例------完成用户登录
- SpannableString富文本
- ES6 二进制数组
- 03 CheckBox 复选框
- google cache源码详解
- 一款Android图文识别与扫描软件
- Alpha冲刺(5/10)——2019.4.27
- asp.net core mvc上传大文件解决方案
- JAVA验证身份证格式及合法性
- SQLSERVER 中sp_who, sp_who2和sp_who3(转载)
- about Version Control(版本控制)
- Oracle VM VirtualBox CentOS7桥接设置问题解决
热门文章
- linux驱动路径
- 从零开始学ios开发(六):IOS控件(3),Segmented Control、Switch
- iPad横屏模式研究
- Linq to XML 之XElement的Descendants方法的新发现
- UML 小结(6)- UML九种图的比较与学习
- [搜片神器]使用C#实现DHT磁力搜索的BT种子后端管理程序+数据库设计(开源)
- 生成最小树prim算法
- 虚拟机备份转移后,网络启动异常,提示“SIOCSIFADDR: No such device”的解决方案
- sql查询结果本身要被使用两次
- NYOJ-32 组合数 AC 分类: NYOJ 2014-01-02 22:21 112人阅读 评论(0) 收藏