我正在尝试通过情节提要启动xib文件。
故事板
Main.storyboard
当我单击按钮时,在情节提要中的触摸事件内
GLViewController *viewController=[[GLViewController alloc]initWithNibName:@"GLViewController" bundle:nil]; [self presentViewController:viewController animated:YES completion:nil];
我将Xib文件重命名为GlViewController.xib
,与Xib的ViewController类名相同。
运行时出现错误:
Unknown class _TtC9MyApp16GLViewController in Interface Builder file.
MyApp[92282:1995489] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GLViewController 0x7f9f10420110> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key delegate.'
但是我在编译源代码中有GLViewController,并且在Storyboard的ViewController顶部引用它。