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. Intellij Idea 创建JavaWeb项目入门(一)

    Idea创建JavaWeb项目步骤:1.打开Intellij Idea IDE,然后点击Create New Project 2.左侧选择Java Enterprise,右侧选择Web Applica ...

  2. This is me

    This is me 爱琴棋 爱书画 也爱格物 爱跋山 爱涉水 也爱深林 This is me. 刘伯承的诗词有曰“高耸入云”,于是“李入云”便成为了我一生的标记,也造就了一个时而安静,时而疯狂的我 ...

  3. "软件"和"软件工程"一词最早被谁提出?

    1."softwar”:1953年Richard R.Carhart在备忘录中使用software一词2.软件工程 1968 年北大西洋公约组织在前联邦德国开会提出的 1968年秋季,NAT ...

  4. 《Linux内核分析》第五周学习总结 扒开系统调用的三层皮(下)

    扒开系统调用的三层皮(下) 郝智宇 无转载 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.给Men ...

  5. 做业5.2 TDD

    package runok;import java.util.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt ...

  6. C++中清空缓冲区

    C++中标准输入cin有多种输入方式.. 这篇文章罗列的还是简要易懂的.C++输入cin详解...如果只是简单的使用cin>>的话,会单个token的读入.但是会忽略换行符,空格,制表符等 ...

  7. HDU 2028 Lowest Common Multiple Plus

    http://acm.hdu.edu.cn/showproblem.php?pid=2028 Problem Description 求n个数的最小公倍数.   Input 输入包含多个测试实例,每个 ...

  8. Windows 设置开机自动登录

    1. 自己一些windows的虚拟机 有时候开机之后 输入用户名密码时间特别长. 需要等待很久, 如果能够设置开机自动登录的话 能够节约很多时间. 2. 最简单的办法  运行输入 control us ...

  9. jenkins 添加 k8s 云

    同事的jenkins 链接自己的 k8s 总是出问题 给出了资料和服务器 进行处理. 同时给出的参考资料:https://blog.csdn.net/diantun00/article/details ...

  10. NGINX.conf配置文件支持pathinfo

    # power by www.php.cn #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/e ...