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

  方法一:
          UIBarButtonItem *button= [[UIBarButtonItem alloc] initWithImage:nil style:UIBarButtonItemStyleDone target:self action:@selector(action:)];
          self.navigation.rightBarButtonItem = button;
 
  方法二:
          UIButton *button =[ [UIButton alloc] initWithFrame:CGRectMake(0,0,30,30)];
          [button setImage:[UIImage imageNamed:@“”] forState:UIControlStateNormal];
          [button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
          UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:button];
          self.navigationItem.rightBarButtonItem = rightItem;
 

  

最新文章

  1. 以.net core重构原有.net framework过程中的一些API变更记录(持续更新)
  2. Angular.js中使用$watch监听模型变化
  3. iOS学习20之UIView
  4. 《图解密码技术》-chaper1-概述
  5. Angular-UI-Router
  6. ThinkPHP第三天(公共函数Common加载,dump定义,模板文件,定义替换__PUBLIC__)
  7. V离MWare至Openstack至FDIO
  8. 继承control的自定义TextBox
  9. google浏览器图标显示不正常怎么办
  10. python列表很聪明,支持负数索引
  11. MVVM以及vue的双向绑定
  12. BZOJ3277 串 【后缀数组】【二分答案】【主席树】
  13. Distance
  14. 把查询的数据导出到elsx表 关于流的概念
  15. sql语句Order by 报错列名不明确
  16. Windows上PostGIS(压缩版)安装
  17. MariaDB的存储过程和函数
  18. 【分享】Linux(Ubuntu)下如何自己编译JDK
  19. 雷林鹏分享:Ruby 哈希(Hash)
  20. POJ 2251 Dungeon Master(多层地图找最短路 经典bfs,6个方向)

热门文章

  1. 代码演示用 KnockoutJS 和 Web API 对一个表格(Gird)进行 CRUD 操作,在 MVC 5 下
  2. 12306外包给阿里巴巴/IBM到底是否可行?
  3. 利用__index和__newindex实现默认值表、监控表、只读表
  4. Mysql查询大表出现的一个错误
  5. 2015 Multi-University Training Contest 1 - 1002 Assignment
  6. 重构第20天 提取子类(Extact SubClass)
  7. Java集合Iterator迭代器的实现
  8. ThreadLocal的基本原理与实现
  9. LeetCode1:Two Sum
  10. mysql select语句解析