//以下四个条件缺一不可

/.必须是半透明状态
self.navigationBar.translucent = YES;
//2.导航栏背景图片为空图片 (不可以设置backgroundColor或者barTintColor, 没有效果的)
[self.navigationBar setBackgroundImage:[[UIImage alloc]init] forBarMetrics: UIBarMetricsDefault];
//3.阴影图片为空图片 (不可以设置为nil,没用的)
[self.navigationBar setShadowImage:[[UIImage alloc] init]]; //其实到导航栏才44px, 但是backgroundView有64px
self.navigationBar.layer.masksToBounds = YES;

导航除线

self.navigationController.navigationBar.translucent = NO;
self.navigationController.navigationBar.shadowImage = [UIImage new];
UIImage *img = [UIImage imageWithColor:[UIColor greenColor] size:CGSizeMake(, )];
//必须设置一张图片而不是设置背景颜色
[self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];

3.设置设置titleView时, titleView的宽度和高度无法自由设置

设置搜索案例

如果已经设置了默认返回的图标, 你会发现设置titleview时, 你的titleview左边会空出一块

UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(, , , )];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:tf];
self.navigationItem.leftBarButtonItem = item;

最新文章

  1. 如何用fir.im 命令行工具 打包上传
  2. C#继承里的【就近原则】
  3. << CocoaPods安装和使用教程 >>github code4app以及cocoachina 苹果官方文档
  4. 实例:图形绘制[OpenCV 笔记15]
  5. spring 学习 AOP和IOC
  6. grunt中常见的插件
  7. python 标准库 -- configparser
  8. spring mvc获取绝对路径的几种方法
  9. TCP协议中三次握手
  10. Pytorch
  11. [Swift]LeetCode537. 复数乘法 | Complex Number Multiplication
  12. pythonのdjango
  13. Slimming Plan
  14. HDFS集群优化篇
  15. springboot配置server相关配置&整合模板引擎Freemarker、thymeleaf&thymeleaf基本用法&thymeleaf 获取项目路径 contextPath 与取session中信息
  16. Springboot学习04-默认错误页面加载机制源码分析
  17. 关于OpenJDK和Orcale JDK区别
  18. Twitter Bootstrap3小结
  19. .net MVC 登陆模块后台代码
  20. readonly const

热门文章

  1. Yocto开发笔记之《快速入门,环境搭建 & 编译》(QQ交流群:519230208)
  2. JavaWeb学习笔记——Web开发模式:Mode I和Mode II
  3. ubuntu下Eclipse下添加GBK编码
  4. Jquerymobile 简单安装
  5. Unity 播放 视频
  6. Django笔记-常见错误整理
  7. valuestack,stackContext,ActionContext.之间的关系以及如何存取数值的
  8. js变量在属性里的写法 常用mark 多个DL遍历添加一个父级DIV
  9. Kafka【第一篇】Kafka集群搭建
  10. Python开发【第十八篇】:MySQL(二)