本文介绍了Objective-c:使用导航栏启动带有第二个视图的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Ipad创建一个应用程序,我使用导航栏创建了3个视图,但我不是在第一个但在第二个视图中启动我的应用程序,我该怎么办?

I'm creating an App for Ipad, I created 3 views with a navigation bar but I would to start my application not in first but in second view, what can i do?

推荐答案

您可以设置,初始导航堆栈通过 setViewControllers:animated:

You can setup UINavigationController with an initial navigation stack via setViewControllers:animated:.

// in application:didFinishLaunchingWithOptions:

self.navigationController = [[UINavigationController new] autorelease];

UIViewController *first = [[MyFirstViewController new] autorelease];
UIViewController *second = [[MySecondViewController new] autorelease];
NSArray *controllers = [NSArray arrayWithObjects:first, second, nil];

[navigationController setViewControllers:controllers animated:NO];

...
[window addSubview:navigationController.view];

这篇关于Objective-c:使用导航栏启动带有第二个视图的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 22:47