navigationItem的设置和titleView的设置
设置导航栏中间的标题
self.navigationItem.title = @"title";
设置导航栏的主题颜色
self.navigationBar.barTintColor = [主题色];
设置导航栏的标题文字颜色
[self.navigationController.navigationBar setBarTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor grayColor]}];
设置背景颜色
[self.navigationBar setBarTintColor:[UIColor redColor]];
设置UIBarButtonItem的样式及图标颜色
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(leftItemClick)];
leftItem.tintColor=[UIColor grayColor];
self.navigationItem.leftBarButtonItem = leftItem;
设置图片成为导航栏的标题
UIImageView* imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"marker"]];
self.navigationItem.titleView = imageView;
设置后退按钮的文字,和样式;
/**
UIBarButtonItemStylePlain,
UIBarButtonItemStyleBordered NS_ENUM_DEPRECATED_IOS(2_0, 8_0, "Use UIBarButtonItemStylePlain when minimum deployment target is iOS7 or later"),
UIBarButtonItemStyleDone,
*/
UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(backClick)];
self.navigationItem.backBarButtonItem = backItem;
//点击Cell跳转控制器
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController* VC = [[UIViewController alloc]init];
[VC.view setFrame:[UIScreen mainScreen].bounds];
VC.view.backgroundColor = [UIColor redColor];
//设置返回按钮的颜色
self.navigationController.navigationBar.tintColor=[UIColor grayColor];
[self.navigationController pushViewController:VC animated:YES];
}
//设置导航栏中title字体颜色及大小
UILabel *LB = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
LB.text = @"ZCL";
LB.font = [UIFont systemFontOfSize:8];
LB.textColor = [UIColor redColor];
//设置位置在中心
LB.textAlignment = NSTextAlignmentCenter;
self.navigationItem.titleView = LB;
//自定义导航栏(搜索框)
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 50, 30)];
searchBar.placeholder = @"输入科室进行查找";
self.navigationItem.titleView = searchBar;
navigationItem的设置和titleView的设置的更多相关文章
- titleView发生偏移、titleView与masonry、titleView的设置、titleView的使用
navigationItem的titleView属性的设置本身是很简单的,容易出问题的原因是自动化布局与frame混用造成的. 本文一步一步的讲解,力求找到问题的起源.如果你也在这块同样遇到问题,不妨 ...
- WinForm容器内控件批量效验是否允许为空?设置是否只读?设置是否可用等方法分享
WinForm容器内控件批量效验是否允许为空?设置是否只读?设置是否可用等方法分享 在WinForm程序中,我们有时需要对某容器内的所有控件做批量操作.如批量判断是否允许为空?批量设置为只读.批量设置 ...
- iOS开发--应用设置及用户默认设置【2、读取应用中的设置】
在上一节中,我们通过探讨应用的系统设置的基本功能,了解运用bundle捆绑包以及plist文件的基本开发.用户能够使用设置应用来声明他们的偏好设置,那么我们怎样去调用用户所设置的参数呢 ...
- iOS开发--应用设置及用户默认设置【1、bundle的运用】
在iphone里面,应用都会在“设置”里面有个专属的应用设置,选择该菜单界面,用户便可以在其中输入和更改各种选项,协助用户更便捷设置个人喜好与习惯. 在这一节中,希望能通过对捆绑包(bu ...
- iOS开发--应用设置及用户默认设置——转载
[链接]iOS开发--应用设置及用户默认设置[1.bundlehttp://www.jianshu.com/p/6f2913f6b218 在iphone里面,应用都会在“设置”里面有个专属的应用设置, ...
- TP-Link 无线路由器设置图文教程----怎么设置TP-Link无线路由器图解
转自:http://www.jb51.net/softjc/39399.html 无线路由器的基础配置 在我们第一次配置无线宽带路由器时,参照说明书找到无线宽带路由器默认的IP地址是192.168.1 ...
- 跨域访问-需要设置HTTP响应标头设置
跨域访问-需要设置HTTP响应标头设置 前提:服务端网站的配置(被请求的网站) 1.需要在IIS服务器站点的功能视图中设置HTTP响应标头: 2.双击“HTTP响应标头”进入设置界面 3.点击右侧添加 ...
- Django 1.6 最佳实践: 如何设置django项目的设置(settings.py)和部署文件(requirements.txt)
Django 1.6 最佳实践: 如何设置django项目的设置(settings.py)和部署文件(requirements.txt) 作者: Desmond Chen,发布日期: 2014-05- ...
- 文件和目录之设置用户ID和设置组ID
与一个进程相关联的ID有6个或更多,它们如表4-4所示: 表4-4 与每个进程相关联的用户ID和组ID 实际用户ID 我们实际上是谁 实际组ID ...
随机推荐
- github 小白教程
工作整天在忙,也没好好有整块的时间去学学东西,记录一下github的学习过程,以便日后好回顾,我一直坚信只有被大家分享的知识,才是好知识. github是什么?一定有人会有这样的疑问.那么如果说到gi ...
- classpath: spring 中的查找方式
Spring可以通过指定classpath*:与classpath:前缀加路径的方式从classpath加载文件,如bean的定义文件.classpath*:的出现是为了从多个jar文件中加载相同的文 ...
- ACdream 1210 Chinese Girls' Amusement(高精度)
Chinese Girls' Amusement Time Limit:1000MS Memory Limit:64000KB 64bit IO Format:%lld & ...
- QLineEdit使用总结(转)
本文转自 https://www.cnblogs.com/hellovenus/p/5183593.html
- Demystifying iOS Application Crash Logs
http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs This is a blog post by So ...
- cannot load shared object file undefined symbol
cannot load shared object file undefined symbol 场景: 共享库里引用了主程序一个符号,结构编译的时候没问题,运行时用 dlopen 打开共享库报上述错误 ...
- linux内核情景分析之execve()
用来描述用户态的cpu寄存器在内核栈中保存情况.可以获取用户空间的信息 struct pt_regs { long ebx; //可执行文件路径的指针(regs.ebx中 long ecx; //命令 ...
- python接口自动化3-自动发帖(session)【转载】
本篇转自博客:上海-悠悠 原文地址:http://www.cnblogs.com/yoyoketang/tag/python%E6%8E%A5%E5%8F%A3%E8%87%AA%E5%8A%A8%E ...
- 关于JAVA SESSION的小测试
手生就要多练啊... package com.jeelearning.servlet; import java.io.IOException; import java.io.PrintWriter; ...
- Netty源码学习(六)ChannelPipeline
0. ChannelPipeline简介 ChannelPipeline = Channel + Pipeline,也就是说首先它与Channel绑定,然后它是起到类似于管道的作用:字节流在Chann ...