我有两个不同的故事板,名为“MainStoryboard”和“TPStoryboard”。在TPStoryboard中,我将CCViewController设置为我的初始视图控制器(名称在此更改)。连接两个故事板
在MainStoryBoard中,我有一个tableView,当用户选择一个单元格时,他预计会落在TPStoryboard的初始视图控制器中。以下是我写的代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIStoryboard *stb = [UIStoryboard storyboardWithName:@"TPStoryboard" bundle:nil];
CCViewController *ccv = [stb instantiateInitialViewController];
[self.navigationController pushViewController:ccv animated:YES];
}
这使异常
“终止应用程序由于未捕获的异常‘NSInvalidArgumentException’,理由是:“找不到一个名为情节串连图板‘在TPStoryboard’捆绑NSBundle“
先不捕捉异常,实际上让你的程序崩溃,以便你可以确切知道出了什么问题。 –
是的,按照你的建议做了,并得到了例外,我发布在“编辑”下的问题 – thandasoru
故事板是否添加到目标? –