How to dismiss the two or more dismissModalViewController?

后端 未结 5 1163
孤城傲影
孤城傲影 2020-12-19 11:26

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

        UINavigationController* navController = self.navigat         


        
5条回答
  •  生来不讨喜
    2020-12-19 12:13

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

    if you set the object at index 0 in the above code its gonna take you to first view which is a push view controller.

    1)Rootview--->moodalview1--->moodalview2--->moodalview3 if you use above code then you wiil be in root view.

    2)Rootview--->Pushview1---->moodalview1--->moodalview2----->moodalview3. if you use above code you will be in the PushView.

提交回复
热议问题