Presenting a view for the first time in appDelegate

后端 未结 4 1185
遥遥无期
遥遥无期 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:01

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.
    
    
        if(!isAgreementAccepted)
        {
    
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"IDD"];
        self.window.rootViewController=vc;
        }
    
        return YES;
    }
    

    If agreement is not accepted set the T&C viewController as rootViewController when user click the accept button then set the TabBarviewController as root.

    u can access the widow object through application delegate any where

    [[[UIApplication sharedApplication]delegate] window].rootViewController=tabViewController.
    

提交回复
热议问题