如果您点击 MORE 按钮,则应隐藏 BACK 按钮,并且应在 NavBar 的左侧添加 MORE,以便您可以执行以下操作:
-(void) moreButtonClicked{
[self.navigationItem setLeftBarButtonItem:nil animated:NO];
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"CLOSE" style:UIBarButtonItemStyleBordered target:self action:@selector (closeButtonClicked:)];
self.navigationItem.leftBarButtonItem = closeButton;
[closeButton release];
}
当您想删除 CLOSE 按钮并将 BACK 按钮设置在以前的位置时,请尝试以下操作:
[self.navigationItem setLeftBarButtonItem:nil animated:NO];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"BACK" style:UIBarButtonItemStyleBordered target:self action:@selector (backButtonClicked:)];
self.navigationItem.leftBarButtonItem = backButton;
[backButton release];