iOS 自定义NavigationBar右侧按钮rightBarButtonItem--button
//两个按钮的父类view
UIView *rightButtonView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
//历史浏览按钮
UIButton *historyBtn = [[UIButton alloc] initWithFrame:CGRectMake(, , , )];
[rightButtonView addSubview:historyBtn];
[historyBtn setImage:[UIImage imageNamed:@"button_history"] forState:UIControlStateNormal];
[historyBtn addTarget:self action:@selector(historyBtnEvent) forControlEvents:UIControlEventTouchUpInside]; //主页搜索按钮
UIButton *mainAndSearchBtn = [[UIButton alloc] initWithFrame:CGRectMake(, , , )];
[rightButtonView addSubview:mainAndSearchBtn];
[mainAndSearchBtn setImage:[UIImage imageNamed:@"button_filter-"] forState:UIControlStateNormal];
[mainAndSearchBtn addTarget:self action:@selector(mainAndSearchBtnEvent) forControlEvents:UIControlEventTouchUpInside]; //把右侧的两个按钮添加到rightBarButtonItem
UIBarButtonItem *rightCunstomButtonView = [[UIBarButtonItem alloc] initWithCustomView:rightButtonView];
self.navigationItem.rightBarButtonItem = rightCunstomButtonView;
iOS 自定义NavigationBar右侧按钮rightBarButtonItem--button的更多相关文章
- iOS 自定义NavigationBar右侧按钮rightBarButtonItem
自定义右侧的一个按钮 UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithTitle:@"主页" style: ...
- iOS自定义的UISwitch按钮
UISwitch开关控件 开关代替了点选框.开关是到目前为止用起来最简单的控件,不过仍然可以作一定程度的定制化. 一.创建 UISwitch* mySwitch = [[ UISwitchalloc] ...
- iOS自定义NavigationBar
日常开发中少不了用到UINavigationController,但是很多情况都要自定义NavigationBar.依稀记得自己刚开始也踩了好多坑,凑今天有空,就把想到的写下来.有时间了,考虑再把自定 ...
- iOS 自定义UINavigationController返回按钮
主要代码如下: //自定义导航栏返回按钮 self.navigationItem.leftBarButtonItem = ({ //导航栏返回背景视图 UIView *view = [[UIView ...
- 修改navigationbar右侧按钮离屏幕边缘位置
先上代码 UIButton *settingBtn = [Utils creatCustomButtonWithFrame:CGRectMake(, , , ) btnTitle: titleColo ...
- ios 自定义NavgationBar的按钮
UIImage *btnimage = [UIImage imageNamed:@"about.png"]; UIButton *btn = [[UIButton alloc] i ...
- [iOS微博项目 - 1.5] - NavigationBar标题按钮
A.NavigationBar标题按钮 1.需求 在“首页”的导航栏中部设置一个“首页”文字+箭头按钮 统一设置样式 根据实际文本长度调整宽度 消除系统自带的点击高亮效果 点击按钮,箭头上下颠倒 gi ...
- iOS系列 基础篇 06 标签和按钮 (Label & Button)
iOS系列 基础篇 06 标签和按钮 (Label & Button) 目录: 标签控件 按钮控件 小结 标签和按钮是两个常用的控件,下面咱们逐一学习. 1. 标签控件 使用Single Vi ...
- iOS 如何自定义NavigationBar的高度
UINavigationBar的高度在苹果官方的SDK中是固定的44个点,但是实际项目中我们却有可能遇到这样的情况,如下图: 这样的一个UINavigationBar的高度达到了84个点,这就需要我们 ...
随机推荐
- Android adb push 和 pull操作
由于安卓真机本地调试时,每次启动并生成apk然后安装到设备比较费时,而很多情况是仅仅修改了hot 脚本文件(cocos2dx + lua). 所以,使用热更机制把修改后的lua文件push到热更目录( ...
- Eliot
T.S. Eliot - Biographical Thomas Stearns Eliot (1888-1965) was born in St. Louis, Missouri, of an ol ...
- position:absolute/relative/fixed小结
1.绝对定位:position:absolute; 当一个div块的位置被定义为绝对定位absolute时,也就意味着它失去了文档流的位置,后面的文档流会紧跟着补上来接替它的位置.如果上下左右的绝对偏 ...
- 给深度学习入门者的Python快速教程 - 基础篇
实在搞不定博客园的排版,排版更佳的版本在: https://zhuanlan.zhihu.com/p/24162430 Life is short, you need Python 人生苦短,我用Py ...
- Codeforces Round #286 Div.1 A Mr. Kitayuta, the Treasure Hunter --DP
题意:0~30000有30001个地方,每个地方有一个或多个金币,第一步走到了d,步长为d,以后走的步长可以是上次步长+1,-1或不变,走到某个地方可以收集那个地方的财富,现在问走出去(>300 ...
- BZOJ1216[HNOI2003]操作系统 [模拟 优选队列]
1216: [HNOI2003]操作系统 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 754 Solved: 421[Submit][Status ...
- MyBatis配置文件解析
MyBatis配置文件解析(概要) 1.configuration:根元素 1.1 properties:定义配置外在化 1.2 settings:一些全局性的配置 1.3 typeAliases:为 ...
- [No000009]学习重要还是经营人脉重要?
大说数人的朋友圈都是这样的:雪中送炭的寥寥无几,锦上添花的大多数人连你自己都不认识,碰到倒霉的时候还能遇到落进下石的.人脉是很重要,可相对自身的学习来说,就没有想象中那么重要了. 有一次在北大讲座,遇 ...
- java 28 - 5 JDK5的新特性 之 枚举的使用
上一章,自定义了枚举类,超级麻烦.. 所以,JAVA给了一个枚举类:类 Enum<E extends Enum<E>> 注意事项 定义枚举类要用关键字enum 所有枚举类都是E ...
- 转:设置Eclipse中的tab键为4个空格的完整方法
from: https://my.oschina.net/xunxun10/blog/110074 设置Eclipse中的tab键为4个空格的完整方法 收藏 XunXun10 发表于 4年前 阅读 ...