【问题标题】:UINavigationController as child view of UIViewControllerUINavigationController 作为 UIViewController 的子视图
【发布时间】:2011-06-01 19:12:12
【问题描述】:

我有一个不基于导航的应用程序。所以 App Delegate 中没有 UINavigationController。但是,我需要为应用程序的一部分切换到 UINavigationController。我目前采取的步骤...

  • 创建一个扩展 UIViewController 的新类
  • 通过 IB 添加了 UINavigationController
  • 告诉 IB 新 UIViewController 的视图是 UINavigationController 的视图

现在的问题是文件的所有者需要它的视图集。但是通过 IB 没有办法指定这一点。所以很明显,我不会以正确的方式去做。非常感谢任何正确方向的提示。

【问题讨论】:

    标签: iphone ios4 uiviewcontroller uinavigationcontroller


    【解决方案1】:

    在 IB 中连接您的导航控制器(在本例中为 navController)和 init 它与您的控制器:

    MessageViewController *mView = [[MessageViewController alloc]initWithNibName:@"MessageView" bundle:nil];
    mView.navController = [[UINavigationController alloc] initWithRootViewController:mView];
    [self presentModalViewController:mView.navController animated:YES];
    [mView release];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多