我有兩個不同的故事板,名爲「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
故事板是否添加到目標? –