从情节提要中呼叫Xib-目标C

时间:2020-07-28 21:20:25

标签: ios objective-c xib

我正在尝试通过情节提要启动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顶部引用它。

0 个答案:

没有答案