【View Controller】Configuring the Initial View Controller at Launch
来源:互联网 发布:液流电池 知乎 编辑:程序博客网 时间:2024/05/23 13:24
If you define a main storyboard in your project, iOS automatically does a lot of work for you to set up your app.When your app calls theUIApplicationMainfunction, iOS performs the following actions:
It instantiates the app delegate based on the class name you passed into theUIApplicationMainfunction.
It creates a new window attached to the main screen.
If your app delegate implements awindowproperty, iOS sets this property to the new window.
It loads the main storyboard referenced in the app’s information property list file.
It instantiates the main storyboard’s initial view controller.
It sets the window’srootViewControllerproperty to the new view controller.
It calls the app delegate’sapplication:didFinishLaunchingWithOptions:method. Your appdelegate is expected to configure the initial view controller (and its children, if it is a container viewcontroller).
It calls the window’smakeKeyAndVisiblemethod to display the window.
The app delegate configures the controller
<span style="font-size:18px;">- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {UINavigationController *navigationController = (UINavigationController*) self.window.rootViewController; BirdsMasterViewController * firstViewController = [[navigationController viewControllers] objectAtIndex:0]; BirdSightingDataController *dataController = [[BirdSightingDataController alloc] init]; firstViewController.dataController = dataController;return YES; }</span>
Creating the window when a main storyboard is not being used
<span style="font-size:18px;">- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions{self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MyStoryboard"bundle:nil]; MainViewController *mainViewController = [storyboardinstantiateInitialViewController]; self.window.rootViewController = mainViewController; // Code to configure the view controller goes here. [self.window makeKeyAndVisible];return YES; }</span>
- 【View Controller】Configuring the Initial View Controller at Launch
- Applications are expected to have a root view controller at the end of application launch
- Applications are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch
- Applications are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of appliaction launch.
- Applications are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of appliaction launch.
- Application windows are expected to have a root view controller at the end of application launch
- 'Application windows are expected to have a root view controller at the end of application launch'
- Application windows are expected to have a root view controller at the end of application launch
- 'Application windows are expected to have a root view controller at the end of application launch'
- “Application windows are expected to have a root view controller at the end of application launch”
- Application windows are expected to have a root view controller at the end of application launch'
- Application windows are expected to have a root view controller at the end of application launch
- 'Application windows are expected to have a root view controller at the end of application launch'
- Application windows are expected to have a root view controller at the end of application launch
- 'Application windows are expected to have a root view controller at the end of application launch' [
- 导出dll的函数定义
- 数据结构实验
- “段寄存器”的故事
- Struts标签库
- 将应用部署到Tomcat根目录的方法
- 【View Controller】Configuring the Initial View Controller at Launch
- SuperSocket服务器架设(一):认识SuperSocket
- hdu1698 Just a Hook
- JavaScript: 判断一个变量的类型
- VS2010 经常崩溃的一次解决办法
- OC与JAVA通用的AES加密解密
- C++ primer 第五版 中文版 练习 11.20 个人code
- 【Sample Code】Configuring the Destination Controller When a Segue is Triggered
- Pascal's Triangle Pascal's Triangle||