Ios 移动到下一个视图控制器,我正在使用情节提要
这是我的密码Ios 移动到下一个视图控制器,我正在使用情节提要,ios,Ios,这是我的密码 RadarViewController *wc = [[RadarViewController alloc] initWithNibName:@"RadarViewController" bundle:nil]; [self.navigationController pushViewController:wc animated:YES]; 下面是应用程
RadarViewController *wc = [[RadarViewController alloc]
initWithNibName:@"RadarViewController"
bundle:nil];
[self.navigationController pushViewController:wc animated:YES];
下面是应用程序崩溃后出现的错误
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-10-14 12:25:02.596 Quick man help[890:60170] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/brainpulse/Library/Developer/CoreSimulator/Devices/0FD1A490-11AF-468D-96D3-71F37DDD8552/data/Containers/Bundle/Application/35FDBB50-E294-458B-B367-A57E3FC0B594/Quick man help.app> (loaded)' with name 'RadarViewController''
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能有用。
2015-10-14 12:25:02.596快速人工帮助[890:60170]***由于未捕获的异常“NSInternalInconsistenceException”而终止应用程序,原因:“无法在捆绑包中加载NIB:“NSBundle(loaded)”,名称为“Radaviewcontroller”
您的Xcode找不到名为“RadarViewController”的xib,因为您正在使用序列图像板 您需要从故事板创建RadarViewController的实例,如
UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
radarVC = [mystoryboard instantiateViewControllerWithIdentifier:@"radarVCID"];
您需要将radarVCID设置为情节提要中RadarViewController的情节提要ID,请执行以下操作
RadarViewController *obj = [self.storyboard instantiateViewControllerWithIdentifier:@"youridentifier"];//youridentifier =capture as per screenshot. You can give whatever identifier to `RadarViewController`
[self.navigationController pushViewController:obj animated:YES];
1) 在情节提要中选择您的RadarViewController
2) 在Identity Inspector中,在情节提要ID
中提供RadarViewController
标识符。例如,您可以在屏幕截图中看到“捕获”
现在写下下面的内容
RadarViewController *obj = [self.storyboard instantiateViewControllerWithIdentifier:@"youridentifier"];//youridentifier =capture as per screenshot. You can give whatever identifier to `RadarViewController`
[self.navigationController pushViewController:obj animated:YES];
让我知道它是否有效
快乐编码 在您调用
initWithNibName
的那一刻,似乎并非所有作为归档文件一部分的连接都已从情节提要加载,与实例化控件标识符
相同。
我建议您在viewDidLoad
中安装视图控制器。
如果没有帮助,试着看看你的故事板是否正确。要实现这一点,请将其作为源代码打开,并查看开始/结束标记
在所有这些之后,删除视图控制器并重新添加。在执行所有这些操作之前,不要忘记创建情节提要的副本。情节提要中是否有您的RadarViewController?是的,它在我的情节提要中。感谢您的回复,但我已经做了与您的捕获图像相同的操作,再次应用程序崩溃并给出我提到的错误。RadarViewController在您的项目中有任何XIB吗?因为您的错误是“无法加载捆绑包中的NIB”您使用过NavigationController吗?我没有在我的项目中创建任何xib,我从界面生成器创建了一个视图控制器,并指定了一个类名RadarViewController。我已经这样做了,请找到我的RadarViewController.RadarViewController*wc=[[RadarViewController alloc]initWithNibName:@“RadarViewController”bundle:nil];您还需要更改此代码