我的项目中有另一个项目。
TutorialViewController *con = [[TutorialViewController alloc] initWithNibName:@"TutorialViewController" bundle:nil WithFrame:CGRectMake(0, 0, 320, 460) AndImages:imageArray PageControlLocation:kPageControlLocationDown WithColor:[UIColor blackColor]];
[self presentModalViewController:con animated:YES];
我想调用此TutorialViewController
ViewController
,但我认为(知道)编译器找不到这个nib,因为他没有在主包中找到它...
有人知道如何调用此VC
吗?
答案 0 :(得分:1)
您必须通过NSBundle类显式发送路径,例如:
TutorialViewController *con = [[TutorialViewController alloc] initWithNibName:@"TutorialViewController" bundle:[[NSBundle mainBundle] pathForResource:File_Name ofType:FILE_TYPE inDirectory:your_directory]] WithFrame:CGRectMake(0, 0, 320, 460) AndImages:imageArray PageControlLocation:kPageControlLocationDown WithColor:[UIColor blackColor]];
[self presentModalViewController:con animated:YES];
如果您将nil提供给bundle,那么它将在活动项目中搜索该文件。