缺少“后退按钮”在导航栏中
我用这个推送一个新视图:
- (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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经解决了问题出在 MainWindow.xib 中的 NavigationController。
我创建了另一个 NavigationController 并且它可以工作。
I've solved. The problem was the NavigationController in the MainWindow.xib.
I've created another NavigationController and it works.
我认为问题出在你的笔尖上。不幸的是,我没有使用 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.
我今天也遇到这个问题了。对我来说,原因如下:
通常,后退按钮的标题是上一个导航项的标题。当导航项标题为空时,按钮标题将只是“后退”。但是,我添加了所有元素的本地化,包括导航标题。但我使用了图像而不是标题,因此本地化字符串为空。在这种特殊情况下,后栏按钮将完全消失。
希望有一天这会对某人有所帮助,我花了几个小时才找到答案。
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.