我不会使用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];
答案 0 :(得分:0)
我会小心地使用视图控制器的init
方法 - 而是查看initWithNibName:bundle:
。