【发布时间】:2015-07-01 18:59:54
【问题描述】:
我有 3 个 VC(视图控制器)(VC1、VC2、VC3)。
在VC1,我使用了代码:
self.navViewController = [[UINavigationController alloc] initWithRootViewController:viewController];
self.navViewController.view.frame = CGRectMake(self.view.frame.size.width - viewController.view.frame.size.width,
viewController.view.frame.origin.y,
viewController.view.frame.size.width,
viewController.view.frame.size.height);
[self.navigationController addChildViewController:self.navViewController];
[self.navigationController.view addSubview:self.navViewController.view];
[self.navViewController didMoveToParentViewController:self.navigationController];
VC2 正在显示,然后在 VC2 我使用代码将导航控制器推送到 VC3
VC3 *vc3 = [[VC3 alloc] initWithNibName:@"VC3" bundle:nil];
[vc3.view updateConstraintsIfNeeded];
[self.navigationController pushViewController:vc3 animated:YES];
目前,当我添加 sn-p 代码 [vc3.view updateConstraintsIfNeeded]; 时。我看到导航改变和内容视图没有改变和显示。它只是显示了 VC2 的内容视图。
在我的项目中,我使用的是自动布局。我尝试在我的项目中删除自动布局,它运行良好。当我添加自动布局时,它会出错。
它只发生在 iOS 7 上,iOS 8 运行良好。
请帮我解决这个错误。非常感谢!
【问题讨论】:
标签: ios objective-c iphone