我有两个不同的 Storyboard,名为“MainStoryboard”和“TPStoryboard”。在 TPStoryboard 中,我已将 CCViewController 设置为我的初始 View Controller (此处更改了名称)。
在MainStoryBoard中,我有一个tableView,当用户选择一个单元格时,他预计会降落在TPStoryboard的初始 View Controller 中。以下是我写的代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIStoryboard *stb = [UIStoryboard storyboardWithName:@"TPStoryboard" bundle:nil];
CCViewController *ccv = [stb instantiateInitialViewController];
[self.navigationController pushViewController:ccv animated:YES];
}
这给出了异常(exception)
"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'TPStoryboard' in bundle NSBundle"
最佳答案
该错误表明 bundle 中没有此类文件,因此很可能您拼写错误了名称,或者 Storyboard文件未包含在目标中。
关于ios - 连接两个 Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19087626/