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
BOOL check = FALSE;
NSArray *viewControllers = [[self navigationController] viewControllers];
id obj;
for( int i=0;i<[viewControllers count];i++)
{
obj=[viewControllers objectAtIndex:i];
if([obj isKindOfClass:[yourclassname class]])
{
check = TRUE;
break;
}
}
if (check)
{
[[self navigationController] popToViewController:obj animated:YES];
}
else
{
yourclassname *yourclassnameObj=[self.storyboard instantiateViewControllerWithIdentifier:@"yourclassStoryBoardID"];
[self.navigationController pushViewController:yourclassnameObj animated:true];
}