设置导航栏中间的标题

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的设置的更多相关文章

  1. titleView发生偏移、titleView与masonry、titleView的设置、titleView的使用

    navigationItem的titleView属性的设置本身是很简单的,容易出问题的原因是自动化布局与frame混用造成的. 本文一步一步的讲解,力求找到问题的起源.如果你也在这块同样遇到问题,不妨 ...

  2. WinForm容器内控件批量效验是否允许为空?设置是否只读?设置是否可用等方法分享

    WinForm容器内控件批量效验是否允许为空?设置是否只读?设置是否可用等方法分享 在WinForm程序中,我们有时需要对某容器内的所有控件做批量操作.如批量判断是否允许为空?批量设置为只读.批量设置 ...

  3. iOS开发--应用设置及用户默认设置【2、读取应用中的设置】

            在上一节中,我们通过探讨应用的系统设置的基本功能,了解运用bundle捆绑包以及plist文件的基本开发.用户能够使用设置应用来声明他们的偏好设置,那么我们怎样去调用用户所设置的参数呢 ...

  4. iOS开发--应用设置及用户默认设置【1、bundle的运用】

           在iphone里面,应用都会在“设置”里面有个专属的应用设置,选择该菜单界面,用户便可以在其中输入和更改各种选项,协助用户更便捷设置个人喜好与习惯. 在这一节中,希望能通过对捆绑包(bu ...

  5. iOS开发--应用设置及用户默认设置——转载

    [链接]iOS开发--应用设置及用户默认设置[1.bundlehttp://www.jianshu.com/p/6f2913f6b218 在iphone里面,应用都会在“设置”里面有个专属的应用设置, ...

  6. TP-Link 无线路由器设置图文教程----怎么设置TP-Link无线路由器图解

    转自:http://www.jb51.net/softjc/39399.html 无线路由器的基础配置 在我们第一次配置无线宽带路由器时,参照说明书找到无线宽带路由器默认的IP地址是192.168.1 ...

  7. 跨域访问-需要设置HTTP响应标头设置

    跨域访问-需要设置HTTP响应标头设置 前提:服务端网站的配置(被请求的网站) 1.需要在IIS服务器站点的功能视图中设置HTTP响应标头: 2.双击“HTTP响应标头”进入设置界面 3.点击右侧添加 ...

  8. Django 1.6 最佳实践: 如何设置django项目的设置(settings.py)和部署文件(requirements.txt)

    Django 1.6 最佳实践: 如何设置django项目的设置(settings.py)和部署文件(requirements.txt) 作者: Desmond Chen,发布日期: 2014-05- ...

  9. 文件和目录之设置用户ID和设置组ID

    与一个进程相关联的ID有6个或更多,它们如表4-4所示: 表4-4 与每个进程相关联的用户ID和组ID 实际用户ID                            我们实际上是谁 实际组ID ...

随机推荐

  1. 阿里云服务器ubuntu安装java运行环境

    服务器 阿里云服务器ubuntu安装java运行环境 转:http://www.codingyun.com/article/45.html 今天来给大家介绍一下在阿里云ubuntu服务器下安装java ...

  2. 行为型设计模式之模板方法(Template Method)

    结构 意图 定义一个操作中的算法的骨架,而将一些步骤延迟到子类中.Te m p l a t e M e t h o d 使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤. 适用性 一次性 ...

  3. error MSB3073 解决方法(转)

    原文转自 http://blog.csdn.net/yangjie569889321/article/details/28488151 最近将VC2002 代码移植到VC2010,出现编译错误:1&g ...

  4. cygwin设置

    解决乱码问题 # 设置为中文环境,使提示成为中文  export LANG =" zh_CN.UTF-8 " # 输出为中文编码  export OUTPUT_CHARSET =& ...

  5. Linux中tty框架与uart框架之间的调用关系剖析【转】

    转自:http://developer.51cto.com/art/201209/357501.htm 之前本人在"从串口驱动的移植看linux2.6内核中的驱动模型 platform de ...

  6. 不错的usb分析工具!!!---用bus hound分析usb的枚举过程【转】

    转自:http://blog.chinaunix.net/uid-25909619-id-3335199.html 说明:由于分析时是在记事本上分析的,贴到这里出现了格式有点乱,看时请复制到记事本中, ...

  7. Jquery Dom节点常用操作

    select 标签 form提交的时候 提交select标签选中的value值 1. 添加项 $("#select_id").append("<option val ...

  8. centos7 挂载exfat格式的u盘

    下载 两个包 rpm -ivh http://download1.rpmfusion.org/free/el/updates/7/x86_64/f/fuse-exfat-1.2.8-1.el7.x86 ...

  9. java模拟生日发祝福

    1.新建customer表生日都选为当天 所需jar包 2.使用c3p0连接到数据的xml配置文件 3.连接数据库的工具类 package com.cc.birthday; import java.s ...

  10. AC日记——Roma and Poker codeforces 803e

    803E - Roma and Poker 思路: 赢或输或者平的序列: 赢和平的差的绝对值不得超过k: 结束时差的绝对值必须为k: 当“?”时可以自己决定为什么状态: 输出最终序列或者NO: dp( ...