Question: I am working application in which i calling `presentModalViewController` and once finished(calling `dismissModalViewControllerAnimated:YES`) it should immediately call `popToRootViewControllerAnimated`.

But the issue is `dismissModalViewControllerAnimated:YES` is working properly but `popToRootViewControllerAnimated`is not working after it.

The code is shown below:

```
[self.navigationController dismissModalViewControllerAnimated:YES] ;
[self.navigationController popToRootViewControllerAnimated:YES];

```

Answer: 
If you have a navigation controller with a stack of UIViewControllers:

```
[self dismissModalViewControllerAnimated:YES];
[(UINavigationController*)self.parentViewController popToRootViewControllerAnimated:YES];
//UIViewController *vc = [[UIViewController new] autorelease];
//[(UINavigationController*)self.parentViewController pushViewController:vc animated:YES];

```

Assumes, that view controller in which called modal view controller has navigationController.
I guess, you are not calling the 

```
[self.navigationController popToRootViewControllerAnimated:YES];

```

in the target modal viewcontroller. check that.