我对你的要求有点困惑,但我相信你应该做的就是
self.navigationController.navigationItem.rightBarButtonItem.enabled = NO;
这将隐藏按钮,因为它被设置为未启用集....
因此,为了从一种观点转到另一种观点,只需执行
[navController pushViewController:viewController animatedYES];
并从那个观点倒退
[navController popViewControllerAnimated:YES];
现在完全添加它:
// creating UIViewController objects for reference later
View1 *view1 = [[View1 alloc] init];
View2 *view2 = [[View2 alloc] init];
// you are setting the view1 right navigation button in the view1 viewDidLoad
self.navigationController.navigationItem.rightBarButtonItem.enabled = NO;
// now you are pushing to second view
[navController pushViewController:view2 animated:YES];
// now, in the view2 class, where you get the image that sends the
// user back to view 1, just do
[view2.navController popViewControllerAnimated:YES];
// and then wherever you do the pop as shown above, you need to set the
// view1 right bar button to enabled
view1.navigationController.navigationItem.rightBarButtonItem.enabled = YES;
希望这可以帮助!