Presenting a specific view controller from AppDelegate

前端 未结 4 1383
时光说笑
时光说笑 2021-01-05 02:50

I am trying to present a view controller (a passcode request type view) every time my app becomes active. Once the correct passcode is entered, it should pop off the stack.

4条回答
  •  青春惊慌失措
    2021-01-05 03:48

    Solved

    PasscodeViewController *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"passcodeVCID"]; 
    UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:vc];
    navController.navigationBar.hidden = YES;
    vc.mode = @"enable";
    self.window.rootViewController = navController;  
    

    Using in applicationWillEnterForeground method.

提交回复
热议问题