当视图控制器被按下时,如何使 rightBarButtonItem 保持不动?

发布于 2024-08-12 09:09:36 字数 467 浏览 0 评论 0原文

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

- (void)tableView:(UITableView *)tableView
        didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  AnotherViewController *anotherViewController = 
      [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
  [self.navigationController pushViewController:anotherViewController animated:YES];
}

导航控制器的右侧按钮项消失。

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

When I push a view onto my view controller

- (void)tableView:(UITableView *)tableView
        didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  AnotherViewController *anotherViewController = 
      [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
  [self.navigationController pushViewController:anotherViewController animated:YES];
}

the RIGHT BUTTON ITEM of the navigationController DISAPPEARS.

Is there a way to make the self.navigationController.rightBarButtonItem STAY THERE like in the "Notes" application that comes with the iPhone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黑凤梨 2024-08-19 09:09:36

我不相信你不使用未记录的类就可以。但是,如果将 rightBarButtonItem 属性设置为看起来相同的项目,则应该不会有太大差异。

I don't believe you can without using undocumented classes. However, if you set the rightBarButtonItem property to an item that looks the same, there shouldn't be a big difference.

梦晓ヶ微光ヅ倾城 2024-08-19 09:09:36

执行此操作

self.anotherViewController.navigationItem.rightBarButtonItem = self.parentViewController.navigationItem.rightBarButtonItem;

您可以在推送 ChildViewController 后

You can do that with

self.anotherViewController.navigationItem.rightBarButtonItem = self.parentViewController.navigationItem.rightBarButtonItem;

after you´ve pushed the ChildViewController

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文