I have four view controller classes A, B, C, D.
Class D is pushed when the "go" button is pressed from Class A & B.
I have a method in the app delegate which does that for me
-(void)showViewController {
self.ViewController = [[[ViewController alloc] initWithNibName:@"View" bundle:nil] autorelease];
[self.navigationController pushViewController:self.ViewController animated:YES];
}
When the "back" button is pressed from Class D it pops back to either class A & Class B depending on which class pushed Class D
- (void)popViewController {
[self.navigationController popViewControllerAnimated:YES];
}
What I want to implement is suppose if Class A pushes Class D but when the "back" button is pressed in Class D i want it to go to Class C instead of Class A
I have tried to implement the following code
-(void)popToViewController{
[self.navigationcontroller popToViewController:self.ClassCViewController animated:YES]
}
This causes changes in Class B which i do not want.
Any Suggestions ?