我知道如何将 uinavigationcontroller 添加为 Root View 以及如何在 uinavigationcontroller 中推送 View 。
我在第一个 View ( Root View )中感到困惑的是一个带有按钮的简单 View ,当点击此按钮时,它将显示第二个 View 。
我希望第二个 View 为 uinavigationview。
有任何想法如何做到这一点,我尝试寻找解决方案,但没有得到任何解决方案,之前也没有提出任何类似的问题。
基本上,我试图在没有界面生成器的情况下工作来深入学习东西。
最佳答案
假设您以模态方式呈现第二个 View Controller
而不是
UIViewController *vc = [[[UIViewController alloc] init] autorelease];
[self presentModalViewController:vc animated:YES];
做:
UIViewController *vc = [[[UIViewController alloc] init] autorelease];
UINavigationController *nc = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease];
[self presentModalViewController:nc animated:YES];
关于ios - 如何将 uinavigationcontroller 添加为第二个 View 而不是 rootviewcontroller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9079719/