Iphone 当按下视图控制器时,如何使RightBarButtonim保持不变?

Iphone 当按下视图控制器时,如何使RightBarButtonim保持不变?,iphone,rightbarbuttonitem,Iphone,Rightbarbuttonitem,当我将视图推到视图控制器上时 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];

当我将视图推到视图控制器上时

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; [self.navigationController pushViewController:anotherViewController animated:YES]; } -(void)tableView:(UITableView*)tableView DidSelectRowatineXpath:(NSIndexPath*)indexPath { 另一个视图控制器*另一个视图控制器= [[AnotherViewController alloc]initWithNibName:@“AnotherView”捆绑包:nil]; [self.navigationController pushViewController:另一个已设置动画的ViewController:是]; } navigationController的右按钮项消失


有没有办法让self.navigationController.RightBarButtonim像iPhone附带的“Notes”应用程序一样保持在那里?

我认为如果不使用未记录的类,您就无法做到这一点。但是,如果将
RightBarButtonim
属性设置为外观相同的项,则不会有太大差异。

可以使用

self.anotherViewController.navigationItem.rightBarButtonItem = self.parentViewController.navigationItem.rightBarButtonItem;
在您按下ChildViewController之后