navigationBar其实有三个子视图,leftBarButtonItem,rightBarButtonItem,以及titleView。前两种的自定义请参考http://www.cnblogs.com/6duxz/p/4030916.html

titleView的自定义就更简单了,把它看成一个视图,替换或者添加子视图都可以。以下我在titleView添加了两个button

UIButton* actionNewButton = [[UIButton alloc]initWithFrame:CGRectMake(, , , )];
[actionNewButton setTitle:@"测试1" forState:UIControlStateNormal];
actionNewButton.tag=;
[actionNewButton setTitleColor:[UIColor colorWithRed:0.1 green:0.63 blue:0.96 alpha:0.93] forState:UIControlStateNormal];
//actionNewButton.backgroundColor=[UIColor grayColor]; UIButton* classicAction = [[UIButton alloc]initWithFrame:CGRectMake(, , , )];
[classicAction setTitle:@"测试2" forState:UIControlStateNormal];
classicAction.tag=;
[classicAction setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//classicAction.backgroundColor=[UIColor blueColor]; UIView* titleView = [[UIView alloc]initWithFrame:CGRectMake(, , , )];
//titleView.backgroundColor=[UIColor redColor];
[titleView addSubview:actionNewButton];
[titleView addSubview:classicAction]; self.navigationItem.titleView=titleView;

iOS8 自定义navigationItem.titleView的更多相关文章

  1. iOS 将navigationItem.titleView设置为自定义UISearchBar (Ficow实例讲解)

    这篇文章可以解决以下问题: 1.将searchBar设置为titleView后,无法调整位置的问题 : 2.searchBar的背景色无法设置为透明色的问题: 3.searchBar输入框内用户输入的 ...

  2. self.navigationItem.titleView 不居中显示的问题

    自定义一个AUIView, AUIView * v=[AUIView new]; self.navigationItem.titleView = v; 在AUIView类内重写 setFrame -  ...

  3. iOS8自定义推送显示按钮及推送优化

    http://www.jianshu.com/p/803bfaae989e iOS8自定义推送显示按钮及推送优化 字数1435 阅读473 评论0 喜欢2 导语 在iOS8中,推送消息不再只是简单地点 ...

  4. 设置导航栏 self.navigationItem.titleView 居中

    喜欢交朋友的加:微信号 dwjluck2013-(void)viewDidLayoutSubviews{ [self setDisplayCustomTitleText:@"每日头条&quo ...

  5. Android自定义标题TitleView

    Android开发过程中,经常遇到一个项目需要重复的定义相同样式的标题栏,Android相继推出了actionBar, toolBar, 相信有用到的朋友也会遇到一些不如意的时候,比如标题栏居中时,需 ...

  6. iOS8 自定义navigationbar 以及 UIBarButtonItem 边距问题

    一.自定义navigationbar - (void)initNavigationBar{ [self.navigationController setNavigationBarHidden:YES] ...

  7. navigationItem的设置和titleView的设置

    设置导航栏中间的标题 self.navigationItem.title = @"title"; 设置导航栏的主题颜色 self.navigationBar.barTintColo ...

  8. 在iOS11 自定义titleview问题(位置 按钮点击)

    喜欢交朋友的加:微信号 dwjluck2013 1.在自定义titleview的.h文件 里重写 intrinsicContentSize 属性 @property(nonatomic, assign ...

  9. swift项目第八天:自定义转场动画以及设置titleView的状态

    如图效果: 一:Home控制器 /* 总结:1:设置登陆状态下的导航栏的左右按钮:1:在viewDidLoad里用三目运算根据从父类继承的islogin的登陆标识来判断用户是否登陆来显示不同的界面.未 ...

随机推荐

  1. [转]An overview of Openvswitch implementation

    This is NOT a tutorial on how to use openvswitch, this is for developers who want to know the implem ...

  2. Shell 基础 -- 总结几种括号、引号的用法

    Shell 脚本中经常需要用到一些括号.引号表达式,功能各不相同,本文详细介绍一下. 1.双引号 " " 双引号常用于包含一组字符串,在双引号中,除了 "$". ...

  3. B1029 旧键盘 (20 分)

    20/20,第一次没调试就过了. #include<bits/stdc++.h> using namespace std; /* 1.standardize 2.put to the se ...

  4. linux内核分析第三周

    20135103王海宁 linux内核分析第三周 http://mooc.study.163.com/course/USTC-1000029000  按照课堂提供的方法,命令行一行行敲上去,我是手机缓 ...

  5. 实训一(cocos2d-x相关)

    实训内容简介: 大四开始前系里安排的的集中实践环节,根据要求,开发app应用软件. 目标app:Stick_mxj 目的:继续对cocos2d-x的学习,完成实践环节,解决现在对引擎不是很清楚的一些问 ...

  6. “一片空白”的c#

    using System; using System.Collections.Generic; using System.Text; namespace FindTheNumber           ...

  7. Visual studio 2013 安装的漫长过程

    本周有一个任务是安装VS 2013版本,下载了安装包,七点多G,oh my god!!! 图上维持了两三个小时,可能我电脑台low了..... 因为是win7系统,需要进行重启电脑. 安装成功之后. ...

  8. 中间件——dubbo

    DUBBO初探-搭建DUBBO开发环境 2016年10月13日 12:27:49 NeroJings 阅读数:1697 标签: dubbo 更多 个人分类: dubbo   我所理解的DUBBO 相对 ...

  9. Oracle与SQLSERVER修改数据文件的路径

    1. SQLSERVER ALTER DATABASE CWBASEMSS modify file (name = cwbasemss_dat ,filename = 'c:\cwdata\mss\C ...

  10. win10用vncviewer远程登陆ubuntu桌面

    一:安装Ubuntu的服务端桌面环境 # 安装xrdpsudo apt-get install xrdp # 安装xfce4sudo apt-get updatesudo apt-get instal ...