STORYBOARD - 不包含带标识符的视图控制器 [英] STORYBOARD - doesn't contain a view controller with identifier
问题描述
我一直收到以下错误:
I keep getting the following error:
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
上但我仍然收到此错误。
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:
我还删除了导航查看控制器所以现在2个表视图控制器直接连接推动画。
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嵌入在导航控制器中:
you have to set the storyboardId(in this case the viewController is embedded in a Navigation controller:
let lastMinVc = mainStoryBoard.instantiateViewControllerWithIdentifier("lastMinuteNavController") as! UINavigationController
< a href =https://i.stack.imgur.com/nGFh2.png =noreferrer>
这篇关于STORYBOARD - 不包含带标识符的视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!