后推导航按钮未显示在推动视图控制器中 [英] Back Navigation Button Not Showing up in Pushed View Controller

查看:86
本文介绍了后推导航按钮未显示在推动视图控制器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我可以从我的根视图控制器成功推送新的视图控制器(使用基于导航的应用程序使用Core Data模板),但是详细视图,它是来自根视图控制器的单独xib文件,不显示后退导航按钮。我确信我已经在IB中完成了所有正确的连接,其他一切都按预期工作。

I have a problem where I can successfully push a new view controller from my root view controller (using the Navigation-based application using Core Data template), but the detail view, which is a separate xib file from the root view controller, doesn't display the back navigation button. I'm certain that I've done all of the proper connections in IB, and everything else is working as expected.

RootViewController.h

RootViewController.h

@class ItemsViewController;

@interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate> {

IBOutlet ItemsViewController *itemsVC;

}

@property (nonatomic, retain) IBOutlet ItemsViewController *itemsVC;

@end

RootViewController.m

RootViewController.m

#import "ItemsViewController.h"

@synthesize itemsVC;

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
// Pushes to ItemsViewController

ItemsViewController *itemsViewController = [[ItemsViewController alloc] initWithNibName:@"ItemsViewController" bundle:[NSBundle mainBundle]];

[self.navigationController pushViewController:itemsViewController animated:YES];
[itemsViewController release];

}

ItemsViewController是一个UITableViewController子类,有自己的xib,也叫ItemsViewController。再次,它从RootViewController推送,但后退按钮没有显示这样。我受到了印象这是使用导航控制器的免费功能。正如您所料,这是一个非常令人沮丧的障碍,我将不胜感激任何帮助。

ItemsViewController is a UITableViewController subclass with its own xib, also named ItemsViewController. Again, it gets pushed from RootViewController, but the back button doesn't show up like this. I was under the impression that it was a "free" feature of using a navigation controller. As you might expect, this is a very frustrating roadblock and I would appreciate any help.

推荐答案

你的 ItemsViewController 类是否设置了标题属性在 viewDidLoad 方法?

Does your ItemsViewController class set its title property in its viewDidLoad method?

你应该打电话给 [tableView deselectRowAtIndexPath:indexPath animated:YES] 作为 tableView:didSelectRowAtIndexPath:的最后一行,以符合Apple的人机界面指南。

You should call [tableView deselectRowAtIndexPath:indexPath animated:YES] as the last line of tableView:didSelectRowAtIndexPath: to conform to Apple's human interface guidelines.

这篇关于后推导航按钮未显示在推动视图控制器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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