0

我的项目中有另一个项目。

在此处输入图像描述

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,但我认为(知道)编译器没有找到这个笔尖,因为他没有在主包中找到它......

那么有人知道怎么称呼它VC吗?

4

1 回答 1

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 来捆绑,那么它将在活动项目中搜索该文件。

欲了解更多信息:https ://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html

于 2012-11-19T12:19:43.137 回答