Presenting a view for the first time in appDelegate

后端 未结 4 1193
遥遥无期
遥遥无期 2020-12-22 07:21

The goal:

When my app starts up - I need it to display a view before it gets to the \"Home\" screen. Its a tab bar application and this view is not

4条回答
  •  情书的邮戳
    2020-12-22 08:14

    Change the rootviewcontroller of window programaticaly

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    
       UIStoryboard *aStoryBoard=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
       UITabBarController *aTabCtrl=[aStoryBoard instantiateViewControllerWithIdentifier:@"Tab"];
       FirstVC *aFirstCtrl=[aStoryBoard instantiateViewControllerWithIdentifier:@"First"];
    
       if(self.termsHaveBeenAccepted)
          self.window.rootViewController=aFirstCtrl;
       else
          self.window.rootViewController=aTabCtrl;
       return YES;
    }
    

    This will definitely work I have tested.

提交回复
热议问题