这是我的代码
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''
答案 0 :(得分:2)
您的Xcode找不到名称为&#34; RadarViewController&#34;的xib。因为你正在使用故事板......
您需要从故事板中创建RadarViewController的实例,如
UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
radarVC = [mystoryboard instantiateViewControllerWithIdentifier:@"radarVCID"];
您需要在故事板中将radarVCID设置为RadarViewController的storyboardID
答案 1 :(得分:0)
执行以下操作。
1)在故事板中选择RadarViewController
2)在Identity Inspector中,在RadarViewController
中提供Storyboard ID
标识符。例如&#34; capture&#34;正如您在屏幕截图中看到的那样
现在写下面的内容。
RadarViewController *obj = [self.storyboard instantiateViewControllerWithIdentifier:@"youridentifier"];//youridentifier =capture as per screenshot. You can give whatever identifier to `RadarViewController`
[self.navigationController pushViewController:obj animated:YES];
让我知道它是否有效。
快乐编码!!!
答案 2 :(得分:0)