So, I want the RootViewController to be able to handle a different view controller for each cell (okay, I have reasons not to repeat using nibs here).
I can list them all in the didSelectRowAtIndexPath file as follows:
if(condition){ DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]]; dvController.selectedCountry = selectedCountry; [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; } else if (condition2){ DetailViewController2 *dvController2 = [[DetailViewController2 alloc] initWithNibName:@"DetailViewController2" bundle:[NSBundle mainBundle]]; dvController2.selectedCountry = selectedCountry; [self.navigationController pushViewController:dvController2 animated:YES]; [dvController2 release]; dvController2 = nil; }
but it can be quite a long time, and I donβt know another way to do it. Are there any "special controllers" or classes that I can use to solve this problem? I am new to iOS development, so I know a little.
Thanks in advance!
source share