1
votes

I am newbie and developing a single view application for iPhone with various (A, B, C, D) view controller. Root view controller is A and other view controller are presented as

[self presentModalViewController:C animated:YES]; on some button click.

If the application suspends at C or any other view due to phone call or home button or any action and on resume i want to dismiss presented view (C or D or any) and present B .

What should i code? (on appDelegate.m) or Where??

1

1 Answers

0
votes

You can use the AppDelegate method:

Update

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was
    //inactive. If the application was previously in the background, optionally refresh the user interface.
    [self.viewController dismissAnyViewController];
    [self.viewController representBmodelViewController];
}

Implement these two method in your viewContoller, the first one for dismssing any viewController you are present by using

[self dismissModalViewControllerAnimated:NO];

then present your desired viewController.

Read the comment inside the method to understand what does it do.