iOS8 自定义navigationItem.titleView
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的更多相关文章
- iOS 将navigationItem.titleView设置为自定义UISearchBar (Ficow实例讲解)
这篇文章可以解决以下问题: 1.将searchBar设置为titleView后,无法调整位置的问题 : 2.searchBar的背景色无法设置为透明色的问题: 3.searchBar输入框内用户输入的 ...
- self.navigationItem.titleView 不居中显示的问题
自定义一个AUIView, AUIView * v=[AUIView new]; self.navigationItem.titleView = v; 在AUIView类内重写 setFrame - ...
- iOS8自定义推送显示按钮及推送优化
http://www.jianshu.com/p/803bfaae989e iOS8自定义推送显示按钮及推送优化 字数1435 阅读473 评论0 喜欢2 导语 在iOS8中,推送消息不再只是简单地点 ...
- 设置导航栏 self.navigationItem.titleView 居中
喜欢交朋友的加:微信号 dwjluck2013-(void)viewDidLayoutSubviews{ [self setDisplayCustomTitleText:@"每日头条&quo ...
- Android自定义标题TitleView
Android开发过程中,经常遇到一个项目需要重复的定义相同样式的标题栏,Android相继推出了actionBar, toolBar, 相信有用到的朋友也会遇到一些不如意的时候,比如标题栏居中时,需 ...
- iOS8 自定义navigationbar 以及 UIBarButtonItem 边距问题
一.自定义navigationbar - (void)initNavigationBar{ [self.navigationController setNavigationBarHidden:YES] ...
- navigationItem的设置和titleView的设置
设置导航栏中间的标题 self.navigationItem.title = @"title"; 设置导航栏的主题颜色 self.navigationBar.barTintColo ...
- 在iOS11 自定义titleview问题(位置 按钮点击)
喜欢交朋友的加:微信号 dwjluck2013 1.在自定义titleview的.h文件 里重写 intrinsicContentSize 属性 @property(nonatomic, assign ...
- swift项目第八天:自定义转场动画以及设置titleView的状态
如图效果: 一:Home控制器 /* 总结:1:设置登陆状态下的导航栏的左右按钮:1:在viewDidLoad里用三目运算根据从父类继承的islogin的登陆标识来判断用户是否登陆来显示不同的界面.未 ...
随机推荐
- 详细聊聊k8s deployment的滚动更新(二)
一.知识准备 ● 本文详细探索deployment在滚动更新时候的行为 ● 相关的参数介绍: livenessProbe:存活性探测.判断pod是否已经停止 readinessProbe:就绪 ...
- error: Build input file cannot be found: '*******/node_modules/react-native/Libraries/WebSocket/libfishhook.a' 问题解决记录
解决了刚才的'config.h' file not found问题,本以为就可以顺畅的跑起来,谁知道又被恶心到了,Build input file cannot be found!!! 问题: err ...
- This is me
This is me 爱琴棋 爱书画 也爱格物 爱跋山 爱涉水 也爱深林 This is me. 刘伯承的诗词有曰“高耸入云”,于是“李入云”便成为了我一生的标记,也造就了一个时而安静,时而疯狂的我 ...
- DeepID人脸识别算法之三代
DeepID人脸识别算法之三代 转载请注明:http://blog.csdn.net/stdcoutzyx/article/details/42091205 DeepID,眼下最强人脸识别算法.已经三 ...
- Beta 冲刺 四
团队成员 051601135 岳冠宇 031602629 刘意晗 031602248 郑智文 031602330 苏芳锃 031602234 王淇 照片 项目进展 岳冠宇 昨天的困难 数据交换比较复杂 ...
- [转帖]SSL/TLS/WTLS原理
SSL/TLS/WTLS原理 作者:yawl < yawl@nsfocus.com >主页:http://www.nsfocus.com日期:2001-02-19 一 前言 首先要澄清一下 ...
- Jquery 获取屏幕及滑块及元素的高度及距离
alert($(window).height()); //浏览器时下窗口可视区域高度 alert($(document).height()); //浏览器时下窗口文档的高度 alert($(docum ...
- Python:目录和文件的操作模块os.path和OS常用方法
1.目录和文件的操作模块os.path,在使用之前要先导入:import os.path.它主要有以下几个重要的功能函数: #!/user/bin/python #coding= utf-8 impo ...
- File类里的静态字段
我们都知道windows操作系统和Linux操作系统中的路径分隔符是不一样的,当我们直接使用绝对路径的时候,程序会报错误:No such file or diretory”的异常 File类有几个类似 ...
- 本地开启apache虚拟服务器
一般来说,服务器是可以托管多个网站的,只要服务器开启虚拟主机的功能,原理是根据来源的host进行判断,不同的域名实现不同的文件访问,这样就可以实现一个服务器托管不同网站了,只要服务器的性能和带宽足够强 ...