亻五毛

导航

ios-Nav右上角按钮

右上角的设置按钮

1 //******************  右上角保存按钮  ******************
2         UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
3         [rightBtn setBackgroundImage:[UIImage imageNamed:@"xiesixin.png"] forState:UIControlStateNormal];
4         [rightBtn setFrame:CGRectMake(0, 0, 50, 30)];
5         [rightBtn setTitle:@"保存" forState:UIControlStateNormal];
6         [rightBtn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside ];
7         UIBarButtonItem *searchButton = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
8         self.navigationItem.rightBarButtonItem = searchButton;
9         self.tabBarController.hidesBottomBarWhenPushed = YES;
View Code

ms用的不是自定义NavgationController,所以需要使用到 UIBarButtonItem 来设置。

posted on 2014-09-22 11:30  五尐毛  阅读(357)  评论(0编辑  收藏  举报