我有一个表格视图应用程序,我为应该在 iPhone/iPad 上工作的课程编写代码。我可以让电话部分正常工作,并且 ipad 上的拆分视图很好,但是当我在弹出窗口中选择一个项目时,我无法更改右侧的视图控制器。这是我在 MasterViewController.m 中的代码:
#pragma mark - Sal's Methods
-(void) doAbout {
NSLog(@"About");
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
AboutMe *vc = [[AboutMe alloc] initWithNibName:@"AboutMe" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
} else {
AboutMe *vc = [[AboutMe alloc] initWithNibName:@"AboutMe_iPad" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
}
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UISplitViewController *svc = self.splitViewController;
DetailViewController *rightVC = [svc.viewControllers objectAtIndex:1];
switch (indexPath.row) {
case 0:
[self doAbout];
break;
case 1:
NSLog(@"Concurrency");
break;
case 2:
NSLog(@"Sandbox");
break;
case 3:
NSLog(@"Notification");
break;
case 4:
NSLog(@"Email");
break;
case 5:
NSLog(@"Mapkit");
break;
case 6:
NSLog(@"Animate");
break;
case 7:
NSLog(@"Contacts");
break;
case 8:
NSLog(@"SQLlite");
break;
case 9:
NSLog(@"Core Data");
break;
default:
break;
}
}
@end