导航栏设置

//去掉导航条

self.navigationController.navigationBar.hidden = YES;

//去掉push页面的默认左边返回按钮

//要在push之前设置。

- (void)onClickSearch{

MerchantSearchTableViewController *searchTVC = [[MerchantSearchTableViewController alloc]init];

//去掉MerchantSearchTableViewController页的返回按钮

self.navigationController.navigationItem.hidesBackButton = YES;

[self.navigationController pushViewController:searchTVC animated:YES];

}

//设置导航栏右边按钮

UIButton* barButtonItemSearch = [UIButton buttonWithType:UIButtonTypeCustom];

[barButtonItemSearch setTitle:AppLocalizedString(@"Cancel") forState:UIControlStateNormal];

[barButtonItemSearch addTarget:self action:@selector(onClickCancel) forControlEvents: UIControlEventTouchUpInside];

barButtonItemSearch.frame = CGRectMake(screenWith - 32, 0, 22, 22);

UIBarButtonItem *SearchBarButton = [[UIBarButtonItem alloc] initWithCustomView:barButtonItemSearch];

self.navigationItem.rightBarButtonItem = SearchBarButton;

你可能感兴趣的:(导航栏设置)