Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

iphone - How to dismiss the two or more dismissModalViewController?

I need to dismiss the two modal view controllers, I know how to pop two or more view controllers

        UINavigationController* navController = self.navigationController;
    NSArray *array=[navController viewControllers];
    UIViewController* controller = [navController.viewControllers objectAtIndex:0];
    [navController popToViiewController:controller animated:YES];

This is how i can navigate back to my first view but if there are two or more dismiss modal view then how can i navigate back

please help me, Thank you, Madan Mohan

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From the docs for -[UIViewController dismissModalViewController]:

If you present several modal view controllers in succession, and thus build a stack of modal view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...