navigationbar右侧加两个自定义按钮
2015-09-01 18:45
330 查看
UIView *rightBarView = [[UIViewalloc]initWithFrame:CGRectMake(0,0,
60, 31)];
UIButton *phonebutton = [UIButtonbuttonWithType:UIButtonTypeCustom];
phonebutton.frame=CGRectMake(0,5,
25, 25);
[phonebutton
setImage:[UIImageimageNamed:@"phone.png"]forState:UIControlStateNormal];
[phonebutton
addTarget:self
action:@selector(phoneclick)forControlEvents:UIControlEventTouchDown];
[rightBarView addSubview:phonebutton];
UIButton *mapbutton = [UIButtonbuttonWithType:UIButtonTypeCustom];
[mapbutton setFrame:CGRectMake(30,5,
25, 25)];
[mapbutton
setImage:[UIImageimageNamed:@"c_address.png"]forState:UIControlStateNormal];
[mapbutton
addTarget:self
action:@selector(mapclick)forControlEvents:UIControlEventTouchDown];
[rightBarView addSubview:phonebutton];
[rightBarView addSubview:mapbutton];
rightBarView.backgroundColor=[UIColorclearColor];
UIBarButtonItem *rightBtn = [[UIBarButtonItemalloc]initWithCustomView:rightBarView];
self.navigationItem.rightBarButtonItem = rightBtn;
60, 31)];
UIButton *phonebutton = [UIButtonbuttonWithType:UIButtonTypeCustom];
phonebutton.frame=CGRectMake(0,5,
25, 25);
[phonebutton
setImage:[UIImageimageNamed:@"phone.png"]forState:UIControlStateNormal];
[phonebutton
addTarget:self
action:@selector(phoneclick)forControlEvents:UIControlEventTouchDown];
[rightBarView addSubview:phonebutton];
UIButton *mapbutton = [UIButtonbuttonWithType:UIButtonTypeCustom];
[mapbutton setFrame:CGRectMake(30,5,
25, 25)];
[mapbutton
setImage:[UIImageimageNamed:@"c_address.png"]forState:UIControlStateNormal];
[mapbutton
addTarget:self
action:@selector(mapclick)forControlEvents:UIControlEventTouchDown];
[rightBarView addSubview:phonebutton];
[rightBarView addSubview:mapbutton];
rightBarView.backgroundColor=[UIColorclearColor];
UIBarButtonItem *rightBtn = [[UIBarButtonItemalloc]initWithCustomView:rightBarView];
self.navigationItem.rightBarButtonItem = rightBtn;
相关文章推荐
- N—Queen 生成排列+O(n)判断
- python+Eclipse+pydev环境搭建(转)
- 打包volley
- 打包volley
- 解决spring mvc中乱码的问题。
- mousemove事件,鼠标移动过快时,无法全部响应
- 一个酷炫实用的下拉刷新开源库
- 黑马程序员——41,打印流,合并流,对象序列化,管道流,RandomAccessFile
- 打包volley
- ssh+mysql 登陆 及增删改成
- iOS: UIWebView 中不加载图片(即浏览器常见的无图模式)
- linux常用命令(13):less命令
- POJ 题目1436 Horizontally Visible Segments(线段树染色覆盖求相互是否可见)
- 黑马程序员——面向对象(数组工具类+单例设计模式)-第16天
- oracle OCCI编程
- OpenSSL中调用OpenSSL_add_all_algorithms内存泄漏之问题调查
- NYOJ 860 又见01背包(01背包转移方程巧用)
- hdu 3944 DP? lucas定理
- 【AngularJS】—— 12 独立作用域
- JQuery中的DOM操作