views:

58

answers:

2

Hi friends,

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];

Any suggestion is highly appreciated.

Regards,

sathish

+1  A: 

Try something like this:

[self.navigationController dismissModalViewControllerAnimated:YES] ;
[self performSelector:@selector(patchSelector) withObject:nil afterDelay:0.3];


-(void)patchSelector{
  [self.navigationController popToRootViewControllerAnimated:YES]; 
}

It is not so neat but it should work.

UPDATE: You should use

 [self dismissModalViewControllerAnimated:YES];

instead

 [self.navigationController dismissModalViewControllerAnimated:YES] ;

The object that is presenting the modal is the view controller, not the navigation controller.

Jorge
Thanks jorge. its working for me.
sathish kumar
A: 

I guess, you are not calling the

[self.navigationController popToRootViewControllerAnimated:YES];

in the target modal viewcontroller. check that.

Krishnan
thanks krishnan for your suggestion
sathish kumar