故事板不包含带有标识符的视图控制器 [英] Storyboard doesn't contain a view controller with identifier
问题描述
我一直收到以下错误:
Storyboard (<UIStoryboard: 0x7ebdd20>) doesn't contain a view controller with identifier 'drivingDetails'
这是代码:
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"drivingDetails"];
controller.title = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@"name"];
[self.navigationController pushViewController:controller animated:YES];
}
我已经在UIStoryboard
上设置了identifier
,但是仍然出现此错误.
I have already set the identifier
on the UIStoryboard
but I'm still getting this error.
推荐答案
已修复!不仅必须设置segue中的标识符(在我的情况下为DrivingDetails),而且还必须将tableViewController中的标识符设置为DrivingDetails ...检查我的图片:
Fixed! Not only the identifier in the segue must be set, in my case DrivingDetails, but also the identifier in my tableViewController must be set as DrivingDetails...check my picture:
我还删除了导航视图控制器,因此现在将两个表视图控制器直接与推送"动画连接.
I also removed the navigation view controller so now the 2 table view controllers are connected directly with a "push" animation.
*****针对XCODE 7.0的编辑*****
*****EDIT for XCODE 7.0*****
您必须设置StoryboardId(在这种情况下,viewController嵌入在Navigation控制器中:
you have to set the storyboardId(in this case the viewController is embedded in a Navigation controller:
let lastMinVc = mainStoryBoard.instantiateViewControllerWithIdentifier("lastMinuteNavController") as! UINavigationController
这篇关于故事板不包含带有标识符的视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!