如何更改应用启动时加载的默认视图控制器? [英] How to change the default View Controller that is loaded when app launches?

查看:20
本文介绍了如何更改应用启动时加载的默认视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,比如说MyApp",它在应用程序启动时默认加载视图控制器MyAppViewController".后来,我在项目中添加了一个新的视图控制器NewViewControler".

I have an application, say 'MyApp', which by default loads the view controller 'MyAppViewController' whenever the application launches. Later, I added a new view controller 'NewViewControler' to the project.

我现在希望NewViewController"成为我的默认视图控制器,在应用程序启动时加载.

I now want the 'NewViewController' to be my default view controller which loads when the app launches.

请让我知道我需要在我的项目中进行哪些更改才能实现这一目标.

Please let me know what changes I need to make in my project to achieve this.

推荐答案

  1. 打开 MainWindow.xib 并将 MyAppViewController 替换为 NewViewController.
  2. 在您的应用委托类中,将 MyAppViewController 的属性替换为 NewViewController 的属性.将 NewViewController 连接到其在​​ Interface Builder 中的新插座.
  3. application:didFinishLaunchingWithOptions: 中,将 NewViewController 的视图添加到窗口而不是 MyAppViewController 的视图.
  1. Open MainWindow.xib and replace MyAppViewController with NewViewController.
  2. In your app delegate class, replace the property for MyAppViewController with one for NewViewController. Connect NewViewController to its new outlet in Interface Builder.
  3. In application:didFinishLaunchingWithOptions: add NewViewController's view to the window instead of MyAppViewController's view.

这篇关于如何更改应用启动时加载的默认视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆