Programming iOS: clarifications about Root View Controller

后端 未结 4 684
生来不讨喜
生来不讨喜 2020-12-15 11:20

Through this question I would like to know if I understand well the notion of Root View Controller.

In iOS application, the Root View Controller (RVC) is the control

4条回答
  •  时光取名叫无心
    2020-12-15 11:41

    firstly you can create A empty project in Xcode. after you add the new file on objectivec class view controller with xiv. now you can add to this code in appdeligate.m and set the rootviewcontroller in appdeligate

    NOTE:- ViewController.h import to the appdeligate.m

    -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
     {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    // Override point for customization after application launch.
       self.window.backgroundColor = [UIColor whiteColor];
    
       ViewController *viewcontroller =[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
    
    self.window.rootViewController= viewcontroller;
    
    
    
    
     [self.window makeKeyAndVisible];
     return YES;
    

    }

提交回复
热议问题