【发布时间】:2012-07-08 19:48:58
【问题描述】:
所以我在我的应用程序的委托中创建了一个 UINavigationController 并使用我的 RootViewController 实例对其进行了初始化。 UINavigationController 被添加为应用程序 UIWindow 的子视图。 (如果这很重要,我的 RVC 有一个自定义初始化程序。)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_viewController = [[RootViewController alloc] initWithPath:@"/private/var/mobile/"];
_viewController.title = @"mobile";
UINavigationController *nav1 = [[[UINavigationController alloc] initWithRootViewController:_viewController] autorelease];
//This part I'm not sure about as well
[_window addSubview:nav1.view];
[_window makeKeyAndVisible];
return 0;
}
有了这些信息,我正在尝试将另一个 RVC 实例从 UITableView 推送到导航堆栈,如下所示:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//I've tried it without the if statement as well
if(indexPath.section == 0){
RootViewController *detailView = [[RootViewController alloc] initWithPath:launchDirectory];
detailView.title = relativeDirectory;
[self.navigationController pushViewController:detailView animated:YES];
另外,我的 RVC tableview 的数据源和委托已设置为“self”。
我的问题是:为什么即使我选择了表格上的一行,视图仍然保持不变? 该表不会推送到新表,并且在选择一行后我仍然看到相同的单元格内容。换句话说,什么都没有发生……
感谢您的帮助。
【问题讨论】:
标签: ios uitableview sdk uinavigationcontroller