【问题标题】:Pushing new view controller from UITableView on a Tab Bar application在标签栏应用程序上从 UITableView 推送新的视图控制器
【发布时间】:2011-06-16 10:17:03
【问题描述】:

我有一个应用程序,里面有两个栏。 .xib 选项卡之一包括UITableView,当用户选择其中一个单元格时,我想显示另一个UIViewcontroller(.xib 文件),其中包含有关他的选择的信息。

现在,我已经尝试过了

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath { 
NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];   
[self.navigationController pushViewController:nextController animated:YES];     [nextController changeProductText:[arryData objectAtIndex:indexPath.row]]; 
}

什么也没发生,控制台根本没有显示任何错误。

似乎是什么问题?

谢谢!

【问题讨论】:

    标签: ios uitableview uitabbarcontroller pushviewcontroller


    【解决方案1】:

    什么也没发生,因为你的 self.navigationController 返回 nil。 要正确使用导航控制器,您必须至少拥有一个。对于 TabBar 应用程序,对于每个选项卡,您必须关联的不是 UIViewController 子类,而是嵌套在 UINavigationController 中的 UIViewController 子类。这很容易在 .xib 或代码中完成。只是谷歌一些教程。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-23
      • 1970-01-01
      相关资源
      最近更新 更多