本文介绍了如何使用指定的UIViewController启动应用程序?不与第一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有基于视图的应用程序,我不想从第一个标准视图开始,我应该如何从另一个视图开始?!
I've got view-based application, I don't want to start with the first standart view, how should I start with another view?!
推荐答案
您可以更改 MainWindow.xib 文件,以将视图控制器添加为主窗口的子视图.或者,您可以通过以下代码在 applicationdidFinishLaunchingWithOptions:方法中执行此操作.
You can change the MainWindow.xib file to add your view controller as the subview of the main window. Or, you can do it by code like this, in applicationdidFinishLaunchingWithOptions: method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
YourViewController *vc = [[YourViewController alloc] init];
// You can add it as subView
[self.window addSubview:vc];
// Or, add it as rootViewController (available from iOS 4.0)
self.window.rootViewController = vc;
[vc release];
[self.window makeKeyAndVisible];
return YES;
}
这篇关于如何使用指定的UIViewController启动应用程序?不与第一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!