简体   繁体   English

在UIViewController类的导航栏中启用后退按钮?

[英]enable Back Button in navigation bar in UIViewController Class?

i created a navigation based application for my project.. i replaced the launch class from a UITableView subclass to UIViewController subclass without replacing the default tableView in it. 我为我的项目创建了一个基于导航的应用程序。我将启动类从UITableView子类替换为UIViewController子类,而不替换其中的默认tableView。 Now when i navigate to other classes from this class no back button is displayed. 现在,当我从该课程导航到其他课程时,没有显示后退按钮。 i even tried the following code but got no results.. how can i enable the backbutton in my navigation bar?? 我什至尝试了以下代码,但没有结果..如何在导航栏中启用后退按钮? in btw i just updated my iPhone to iOS 4.2.1 just want to confirm if it has some bug due to which back button is not displayed?? 在顺便说一句,我刚刚将我的iPhone更新到iOS 4.2.1,只是想确认它是否由于未显示哪个后退按钮而存在一些错误?

UIBarButtonItem *_backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = _backButton;

There's a hideBackButton property on UINavigationItem. UINavigationItem上有一个hideBackButton属性。 You could set that to false, perhaps? 您可以将其设置为false吗?

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UINavigationItem_Class/Reference/UINavigationItem.html#//apple_ref/occ/instp/UINavigationItem/hidesBackButton http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UINavigationItem_Class/Reference/UINavigationItem.html#//apple_ref/occ/instp/UINavigationItem/hidesBackButton

However, it sounds like there's some reason why it's not showing up, like you're jumping around on the navigation stack manually or something. 但是,听起来好像有某些原因导致它没有显示出来,例如您是手动跳转到导航堆栈上或其他原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM