所以我对这个故事板概念很陌生。我有一个视图笔尖放入情节提要中,每个笔尖都对应于我拥有的 UIViewController 子类,我尝试使用以下代码加载笔尖文件:
TestViewController *vc = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
[self.view setBackgroundColor:[UIColor blueColor]];
[self.view setFrame:CGRectMake(0, self.profilePicture_.frameHeight + self.profilePicture_.frameY + 10, self.scrollView_.frameWidth, 100)];
[self.view addSubview:vc.view];
但是,它给了我以下错误:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/aditya15417/Library/Application Support/iPhone Simulator/5.1/Applications/64E6CEC9-E6DC-4AF5-BF16-11BFB6415BDC/Pulse.app> (loaded)' with name 'TestViewController''
所以问题是,如果我在故事板上有我的笔尖,是否不能使用 initWithNibName?如果有办法,我该怎么做?