In the didFinishLaunchingWithOptions of my application , the code is
_homeViewController = [[HomeViewController alloc]init];
UINavigationController* _navigationController = [[UINavigationController alloc] initWithRootViewController:_homeViewController];
[self.window setRootViewController:_navigationController];
[_navigationController setNavigationBarHidden:YES];
[self.window makeKeyAndVisible];
and in the HomeViewController , I am having two buttons, If the button is pressed , I am presenting the ViewController. If button1 is pressed , the code is
if (_detailsViewController == nil)
_detailsViewController = [[DetailsViewController alloc]init];
[self.navigationController presentModalViewController:_detailsViewController animated:YES];
Now when I am in the detailsViewController and I pressing the iPhone Home button, in the same class I am using the UIApplicationDidEnterBackgroundNotification and calling a method to execute the following line
[self.navigationController popToRootViewControllerAnimated:YES];
So I thought when I open the application again, I can see the HomeViewController, but it doesn’t work. Please help me !!
It seems the reason why I am not able to pop to the root view is , I am presenting the ViewController in between, If the ViewController comes along with the navigation controller, i.e , if the ViewController is pushed as a navigation controller then i can pop to the root view controller