iphone 自定义导航栏按钮
来源:互联网 发布:淘宝全屏导航栏颜色 编辑:程序博客网 时间:2024/06/07 22:10
通常使用的NavigationItem中有backBarButtonItem/leftBarButtonItem/rightBarButtonItem三个按键,其中backBarButtonItem为只读,不能修改,其他两个都可以自由修改.不但可以防止button,还可以用自定义的view来填充,比方说想在导航栏右侧防止两个按钮,
如图所示
代码如下:
UIView *rightBarView = [[UIView alloc]initWithFrame:CGRectMake(618,0, 150, 44)];
UIButton *editBtn = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];
[editBtn setFrame:CGRectMake(10, 10, 50, 25)];
[editBtn addTarget:self action:@selector(editAction:)forControlEvents:UIControlEventTouchUpIns
[editBtn setTitle:@"编辑" forState:UIControlStateNormal]; [editBtnsetTag:11];
[rightBarView addSubview:editBtn];
UIButton *submitBtn = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];
[submitBtn setFrame:CGRectMake(80, 10, 70, 25)];
[submitBtn addTarget:self action:@selector(submitAction:)forControlEvents:UIControlEventTouchUpIns
[submitBtn setTitle:@"提交订单" forState:UIControlStateNormal];[submitBtn setTag:12];
[rightBarView addSubview:submitBtn];
UIBarButtonItem *rightBtn = [[UIBarButtonItemalloc]initWithCustomView:rightBarView];
self.navigationItem.rightBarButtonItem = rightBtn;
- iphone 自定义导航栏按钮
- iphone 导航栏背景
- 导航栏自定义按钮
- 自定义导航栏按钮
- 自定义导航栏左按钮
- 自定义导航栏按钮 标题
- 自定义导航栏返回按钮
- 自定义导航栏返回按钮
- 导航栏之自定义按钮
- 自定义导航栏返回按钮
- iPhone/iPad导航条右上侧添加自定义按钮
- 自定义导航栏上的返回按钮
- UINavigationBar自定义导航栏背景和按钮
- 自定义导航栏上的返回按钮
- UINavigationBar自定义导航栏背景和按钮
- iOS自定义导航栏的返回按钮
- iOS 自定义导航栏标题和按钮
- 自定义导航栏返回按钮文字
- UISwipeGestureRecognizer --…
- iphone里读取gb2312(中文)编码文…
- iphone 导航栏背景
- iphone 表格背景透明
- iphone导航栏隐藏方法
- iphone 自定义导航栏按钮
- 自定义导航栏上的返回按钮
- Objective-c代码
- iphone实现NavigationController&n…
- iphone 读取 一行文件内…
- iphone 读取 大文件的方法
- 怎么在UIView上绘制文本?(How&nb…
- char ,int,long,float,double…
- iPhone loadView 和&nbs…