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 に答える