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;
ms用的不是自定义NavgationController,所以需要使用到 UIBarButtonItem 来设置。