将视图控制器推到导航控制器上时不可见的后退按钮 [英] Invisible back button when view controller pushed onto navigation controller

查看:52
本文介绍了将视图控制器推到导航控制器上时不可见的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用导航控制器在轻按单元格时钻取详细视图.当我将视图控制器推到导航控制器堆栈上时,我希望看到一个后退按钮,可以点击该按钮将上一个视图从堆栈中弹出.

I'm using a navigation controller to drill into a detail view when a cell is tapped. When I push my view controller onto the navigation controllers stack, I expect to see a back button that I can tap to pop the previous view off the stack.

问题是后退按钮不可见,但是在应该的位置上点击时,将返回到前一个视图.有什么问题吗?

The issue is that the back button isn't visible, but when tapping where it should be returns me to the previous view. What's the problem?

推荐答案

确保已为主视图设置了标题-例如在 viewDidLoad 中添加此标题-

Ensure you have set a title for the master view - for example in viewDidLoad add this -

self.title = @"The Title";

奇怪的是,如果堆栈上没有用于父视图控制器的标题,而不是显示一个空的后退按钮,iPhone将不会显示按钮,但会在应有的区域上进行点击.

Weirdly, if there is no title for the parent view controller on the stack, rather than show an empty back button, the iPhone will not display a button but will allow taps on the area where it should be.

这困扰了我很久!

这篇关于将视图控制器推到导航控制器上时不可见的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆