Popping to a specific viewcontroller in a navigation stack

后端 未结 4 1609
Happy的楠姐
Happy的楠姐 2021-02-10 07:47

I have a come across a piece of code to pop to a specific viewcontroller in a navigation stack as below

for (UIViewController* viewController in self.navigationC         


        
4条回答
  •  深忆病人
    2021-02-10 07:52

    for (int m=0; m<[self.navigationController.viewControllers count]; m++)   
    {  
    
            if([[self.navigationController.viewControllers objectAtIndex:m] isKindOfClass:[MyGroupViewController class]])  
                { 
    
                    MyGroupViewController * groupViewController = [self.navigationController.viewControllers    objectAtIndex:m];  
                    [self.navigationController popToViewController:groupViewController animated:YES];   
                 }   
    } 
    

提交回复
热议问题