2013-09-30 72 views
0

我有两个不同的故事板,名为“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“

+2

先不捕捉异常,实际上让你的程序崩溃,以便你可以确切知道出了什么问题。 –

+0

是的,按照你的建议做了,并得到了例外,我发布在“编辑”下的问题 – thandasoru

+1

故事板是否添加到目标? –

回答

1

错误指出捆绑中没有这样的文件,所以很可能是您拼写错误的名称或故事板文件未包含在目标中。

+0

你是对的,它没有被添加到复制包资源。 – thandasoru