iPhone Dev:视图不适合我的UINavigationController

时间:2009-10-03 13:02:54

标签: iphone cocoa-touch uikit uiviewcontroller

我不会使用IB来创建我的视图,因此我通常以编程方式执行所有操作。我基本上将viewController推送到导航控制器,看起来viewController的顶部位于导航栏下方。我正在尝试使视图正确匹配。

这是我的代码:

navigationController = [[UINavigationController alloc] initWithNibName:nil
                                                                bundle:nil];
[window addSubview:navigationController.view];

viewController = [[UIViewController alloc] init];

//this code was just added to try and make it fit. It doesn't change anything
viewController.view.frame = [UIScreen mainScreen].applicationFrame;

[navigationController pushViewController:viewController animated:NO];

1 个答案:

答案 0 :(得分:0)

我会小心地使用视图控制器的init方法 - 而是查看initWithNibName:bundle: