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 ...
随机推荐
- new Date在ios下的兼容bug
今天发现在ios下new Date("2019-03-06").getTime()返回NaN 原因是ios下不支持“-”必须用"/" 记录备忘 var d = ...
- ubuntu安装mysql报错
ubuntu换源后安装mysql报错: 原因:版本高,不兼容,只需要还原apt下载源,然后 sudo apt-get install mysql-server即可正常安装mysql
- win7 无法启动此程序,因为计算机中丢失glut32.dll
http://zhidao.baidu.com/link?url=9NZxqCvR7hvmKuVR1dUSdQB-TTv_re-g7lp-xZj5FKII04FnMvIKjFhKv299t6wv5Ht ...
- BufferedInputStream&BufferedOutputStream
使用字符缓冲区相关实现copy文件: public static void main(String[] args) { //创建文件对象指定要拷贝的文件路径(源文件),文件须存在,测试用例不做判断 F ...
- 网盘+SVN
1.安装网盘 选择一个国内有名的网盘存储,例如金山网盘.360云盘等,注册账户会默认赠送几G的使用空间,然后下载其对应的网盘客户端管理软件(也可以使用浏览器方式),使用账号登录,就可以上传.管理文件等 ...
- 解析转换json xml 集合 ado
json提取 string str = "[{\"JUDGE_RESULT\":\"B类\",\"JUDGE_RESULT\":\ ...
- APP专项测试 | 内存及cpu
命令: adb shell dumpsys meminfo packagename 关注点: 1.Native/Dalvik 的 Heap 信息 具体在上面的第一行和第二行,它分别给出的是JNI层和 ...
- vue编程中,需要注意的
同名情况: data() 中的数据名 和 methods() 中的方法名 不能相同. 原因:因为在vue中这两个都能用this.XX拿出来,如果写一样的,将不能分辨,计算机会默认覆盖一个. ...
- Trapping Rain Water (Bar Height) -- LeetCode
Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...
- 安装php5.4.10时, 错误:‘gdIOCtx’ 没有名为 ‘data’ 的成员
安装php5.4.10时, 错误:‘gdIOCtx’ 没有名为 ‘data’ 的成员 在安装php时,报如下错误 In file included from /kk/php-5.4.0/ext/gd/ ...