How to pop from one view controller to another view controller

前端 未结 8 1327
北荒
北荒 2021-01-31 09:53

Using iOS I Have 15 ViewControllers now I want to pop from one ViewController to another View Controller.

I am using this code:

SecondViewController *Sec         


        
8条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 10:23

    for (UIViewController *controller in self.navigationController.viewControllers)
            {
                if ([controller isKindOfClass:[nameOfYourViewControllerYouWantToNavigate class]])
                {
                    [self.navigationController popToViewController:controller animated:YES];
    
                    break;
                }
            }
    

提交回复
热议问题