0

我正在尝试使用以下命令将 UIViewController 推送到我的导航堆栈:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle: nil];
TestViewController *lvc = (TestViewController *)[storyboard instantiateViewControllerWithIdentifier:@"TestViewController"];
[self.navigationController pushViewController:lvc animated:YES];

TestViewController 在情节提要中有一个场景,并且总是调用 ViewDidLoad 但是如果我通过单击按钮触发此代码,我会得到一个添加导航堆栈的空白视图。它有一个导航标题和返回按钮。如果我单击后退按钮,调用视图也是空白的。

如果我在调用 UIViewController 的 ViewDidLoad 中调用此代码,它会按预期工作,我可以从情节提要中看到视图。然后后退按钮可以正常工作。

我原来的视图会被释放吗?

非常感谢

4

0 回答 0