I’m presenting a testViewController as a rootViewController in didReceiveRemoteNotification which works perfectly. Then when I press the back button of testViewController (to go back to “mainViewController” which in this case is –dismissViewController-), nothing happens. I understand that this happens because of it was presented as a rootView.. and there is nothing to dismiss. How do I control from where or how did testViewController was presented in order to decide on how to proceed when the back button is pressed? I hope you understand what I am trying to say. Any advice would be helpful.
Thank you in advance
ChatViewController *chat = [[ChatViewController alloc] initWithNibName:@"ChatViewController" bundle:nil];
[_window.rootViewController presentViewController:chat animated:YES completion:nil];
You shouldn’t set it as your
rootViewController, but instead make yourrootViewControllerpresent it as a modal view controller:When you call the
-dismissViewControllerAnimated:completion:message, it should go back to yourrootViewController.