Summary of implementation methods of IOS initialization controller

Time:2021-10-12

Summary of implementation methods of IOS initialization controller

1、 Viewcontrollviewcontroller method

#import "AppDelegate.h"
#import "ViewController.h"

@interface AppDelegate ()

@property(nonatomic,strong) ViewController *viewController;

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  //Initialize controller
  self.viewController = [[ViewController alloc]init];
  //Initialize window
  self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
  //Set controller
  self.window.rootViewController = self.viewController;

  return YES;
}

2、 Viewcontrollviewcontroller and Xib method

#import "AppDelegate.h"

#import "XibViewControllViewController.h"

@interface AppDelegate ()

@property(nonatomic,strong) ViewController *viewController;
@property(nonatomic,strong) XibViewControllViewController *xibControllViewController;

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  //Initialize controller
  self.xibControllViewController = [[XibViewControllViewController alloc]initWithNibName:@"XibViewControllViewController" bundle:nil];
  //Initialize window
  self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
  //Set controller
  self.window.rootViewController = self.xibControllViewController;


  return YES;
}

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

Recommended Today

SQL exercise 20 – Modeling & Reporting

This blog is used to review and sort out the common topic modeling architecture, analysis oriented architecture and integration topic reports in data warehouse. I have uploaded these reports to GitHub. If you are interested, you can have a lookAddress:https://github.com/nino-laiqiu/TiTanI recorded a relatively complete development process in my hexo blog deployed on GitHub. You can […]