当按下 tableview 单元格时,使用 tableview 并尝试打开具有故事板和导航控制器的根视图控制器的 collectionviewcontroller 。但收到错误消息
应用程序试图在目标上推送一个 nil 视图控制器
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *viewController;
switch (indexPath.row) {
case PDF:
viewController = [[[PDFExampleViewController alloc] init]autorelease];
break;
case IMAGE:
//Rootviewcontroller of the navigation controller have no identifier. showDetail is the segue of the rootviewcontroller.
viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"showDetail"];
break;
case PROCEDURAL:
viewController = [[[ProceduralExampleViewController alloc] init] autorelease];
break;
default:
viewController = [[[UIViewController alloc] init] autorelease];
}
[self.navigationController pushViewController:viewController animated:YES];
}
感谢帮助。