SecondViewController *testAppViewController2Obj =[[SecondViewController alloc]initWithNibName:@"TestAppViewController2" bundle:nil];
[self.navigationController pushViewController:testAppViewController2Obj animated:YES];
答案 0 :(得分:0)
ContainerViewController *container = [[ContainerViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:container];
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 65)];
container.navigationItem.title = @"Frames";
self.window.rootViewController = nav;
我希望它有效
答案 1 :(得分:-1)
为了推送新的视图控制器,首先应创建一个视图控制器VC1,将其与导航控制器链接,然后将导航控制器链接到AppDelegate中的rootViewController
#AppDelegate
FirstViewController *VC1 = [FirstViewController new];
UINavigationController *nVC = [UINavigationController alloc] initWithRootViewController:VC1];
self.window.rootViewController = nVC;
然后当推送VC1时,您可以创建另一个视图控制器并按下这样推送:
#Now in VC1
SecondViewController *VC2 = [SecondViewController new];
[self.navigationController pushViewController:VC2 animated:YES];