我有以下代码:
UINavigationController localNavigationController = [[[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:self options:nil] objectAtIndex:0];
这是CustomView.xib
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWindow setParentViewController:]: unrecognized selector sent to instance 0x5b74fe0'
答案 0 :(得分:0)
如果你正在加载NIB,并要求索引0处的对象,那不就是UIWindow吗?你在哪里使用导航控制器?如果您在主应用程序中使用它,为什么不直接创建iVar和它作为IBOutlet的属性并将其连接起来?它将自动为您加载...