NavigationController的使用整理
1.设置NavigationBar的背景色:
self.navigationController.navigationBar.barTintColor = [UIColor redColor];
2.设置NavigationBar上的标题
self.navigationItem.title = @"Test";
3.设置NavigationBar上标题的字体大小和颜色(使用富文本)
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor yellowColor],NSForegroundColorAttributeName,[UIFont systemFontOfSize:50],NSFontAttributeName, nil];
4.设置NavigationBar背景图:
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"1"] forBarMetrics:UIBarMetricsDefault];
5.隐藏/显示返回键
在需要隐藏返回键的界面设置:
self.navigationItem.hidesBackButton = NO;
6.保留返回箭头,去除返回标题或者改成其他标题
在push进来的上一级界面中设置:
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
backItem.title = @"";(不要标题就设置空字符串,其他标题直接写字符串就好了)
self.navigationItem.backBarButtonItem = backItem;
7.修改返回键以及标题颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
8.自定义rightButton
最新文章
- 以.net core重构原有.net framework过程中的一些API变更记录(持续更新)
- Angular.js中使用$watch监听模型变化
- iOS学习20之UIView
- 《图解密码技术》-chaper1-概述
- Angular-UI-Router
- ThinkPHP第三天(公共函数Common加载,dump定义,模板文件,定义替换__PUBLIC__)
- V离MWare至Openstack至FDIO
- 继承control的自定义TextBox
- google浏览器图标显示不正常怎么办
- python列表很聪明,支持负数索引
- MVVM以及vue的双向绑定
- BZOJ3277 串 【后缀数组】【二分答案】【主席树】
- Distance
- 把查询的数据导出到elsx表 关于流的概念
- sql语句Order by 报错列名不明确
- Windows上PostGIS(压缩版)安装
- MariaDB的存储过程和函数
- 【分享】Linux(Ubuntu)下如何自己编译JDK
- 雷林鹏分享:Ruby 哈希(Hash)
- POJ 2251 Dungeon Master(多层地图找最短路 经典bfs,6个方向)
热门文章
- 代码演示用 KnockoutJS 和 Web API 对一个表格(Gird)进行 CRUD 操作,在 MVC 5 下
- 12306外包给阿里巴巴/IBM到底是否可行?
- 利用__index和__newindex实现默认值表、监控表、只读表
- Mysql查询大表出现的一个错误
- 2015 Multi-University Training Contest 1 - 1002 Assignment
- 重构第20天 提取子类(Extact SubClass)
- Java集合Iterator迭代器的实现
- ThreadLocal的基本原理与实现
- LeetCode1:Two Sum
- mysql select语句解析