移动到下一个视图控制器,我用故事板
这里是我的代码
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''
您的Xcode不能找到名为“RadarViewController”因为你使用一个故事板厦门国际银行....
你需要从故事板创建RadarViewController的实例像
UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
radarVC = [mystoryboard instantiateViewControllerWithIdentifier:@"radarVCID"];
你需要将雷达VCID设置为故事板中的RadarViewController的storyboardID
我已经做到了,请找到我的radarviewcontroller的屏幕快照。 –
RadarViewController * wc = [[RadarViewController alloc] initWithNibName:@“RadarViewController” bundle:nil];您还需要更改此代码 –
做下面的事情。
1)选择在故事板
2)在身份检查RadarViewController
,给RadarViewController
标识符Storyboard 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];
让我知道它工作与否。
快乐编码!
感谢您的回复,但我已经完成了与捕获图像相同的操作,同样是应用程序崩溃,并提供了我提到的错误。 –
RadarViewController在您的项目中是否有任何XIB?因为你的错误是说“无法在包中加载NIB” – NiravPatel
你使用过NavigationController吗? – NiravPatel
你的雷达观察控制器在故事板? – NiravPatel
是的,它在我的故事板中。 –