2011-09-05 161 views
0

我有下面的代码加载一个UINavigationController:从笔尖

UINavigationController localNavigationController = [[[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:self options:nil] objectAtIndex:0]; 

而这里的CustomView.xib

enter image description here

我在接线错了?我收到以下错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWindow setParentViewController:]: unrecognized selector sent to instance 0x5b74fe0' 
+1

从对象类别中删除窗口 – Robin

回答

0

如果您正在加载的NIB,并在索引0,询问的对象,就不会是这样的一个UIWindow?你在哪里使用导航控制器?如果您在主应用程序中使用它,为什么不只是为它创建一个iVar和一个属性作为IBOutlet并将其挂钩?它会自动为你加载...