缺少“后退按钮”在导航栏中

发布于 2024-10-08 16:03:30 字数 505 浏览 9 评论 0原文

我用这个推送一个新视图:

- (IBAction)selectName:(id)sender {
     SelectNameViewController *nameController = [[SelectNameViewController alloc]
                                              initWithNibName:@"SelectNameView"
                                              bundle:nil];
    [self.navigationController pushViewController:nameController animated:YES];
    [nameController release];
}

但是在新视图的导航栏中,没有后退按钮。

为什么会这样?我知道我可以创建自定义后退按钮,但我想要默认的后退按钮,我该如何修复它?

谢谢

I push a new view with this:

- (IBAction)selectName:(id)sender {
     SelectNameViewController *nameController = [[SelectNameViewController alloc]
                                              initWithNibName:@"SelectNameView"
                                              bundle:nil];
    [self.navigationController pushViewController:nameController animated:YES];
    [nameController release];
}

But in the navigationbar of the new view, there isn't the back button.

Why this? I know I can create a custom back button, but I want the default, how can I fix it?

Thanks

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

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

发布评论

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

评论(3

愿与i 2024-10-15 16:03:30

我已经解决了问题出在 MainWindow.xib 中的 NavigationController。
我创建了另一个 NavigationController 并且它可以工作。

I've solved. The problem was the NavigationController in the MainWindow.xib.
I've created another NavigationController and it works.

无名指的心愿 2024-10-15 16:03:30

我认为问题出在你的笔尖上。不幸的是,我没有使用 Interface Builder,因此我不知道问题是什么。

I think the problem is in your nib. Unfortunately I am not using Interface Builder therefore I have no idea what the problem could be.

无所谓啦 2024-10-15 16:03:30

我今天也遇到这个问题了。对我来说,原因如下:

通常,后退按钮的标题是上一个导航项的标题。当导航项标题为空时,按钮标题将只是“后退”。但是,我添加了所有元素的本地化,包括导航标题。但我使用了图像而不是标题,因此本地化字符串为空。在这种特殊情况下,后栏按钮将完全消失。

希望有一天这会对某人有所帮助,我花了几个小时才找到答案。

I also had this problem today. For me, the reason was the following:

Normally, the title of the back button is the title of the previous navigation item. When the navigation item title is empty, the button title will be just "back". However, I added a localisation for all elements, including the navigation title. But I used an image instead of the title, so the localisation string was empty. In that special case, the back bar button will disappear completely.

Hope this helps someone someday, took me some hours to find out.

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