Write the code below in the main view controller. Decide to create a custom view based on the value of indexpath.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UISplitViewController *splitController = self.splitViewController; NSMutableArray *arr = [splitController.viewControllers mutableCopy]; CustomViewController *customVC = [[CustomViewController alloc]init]; [arr replaceObjectAtIndex:1 withObject:customVC]; [customVC release]; splitController.viewControllers = arr; }
source share