Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在自定义视图Xcode中加载_Objective C_Xcode_Macos - Fatal编程技术网

Objective c 在自定义视图Xcode中加载

Objective c 在自定义视图Xcode中加载,objective-c,xcode,macos,Objective C,Xcode,Macos,这是针对Mac应用程序的,而不是针对iPhone。我想做的是获取我当前的xib“欢迎屏幕”,当它打开时,在一个名为myTargetView的自定义视图中加载另一个xib“WelcomeScreenText1”。运行时,错误消息为“[NSViewController loadView]加载了“WelcomeScreenText1”xib,但未设置任何视图。”请帮助 #import "WelcomeMainViewController.h" #import "WelcomeText1ViewCont

这是针对Mac应用程序的,而不是针对iPhone。我想做的是获取我当前的xib“欢迎屏幕”,当它打开时,在一个名为myTargetView的自定义视图中加载另一个xib“WelcomeScreenText1”。运行时,错误消息为“[NSViewController loadView]加载了“WelcomeScreenText1”xib,但未设置任何视图。”请帮助

#import "WelcomeMainViewController.h"
#import "WelcomeText1ViewController.h"
#import "WelcomeText2ViewController.h"


@implementation WelcomeMainViewController


NSString *const text1Title      = @"WelcomeScreenText1";



- (void)awakeFromNib
{   
            WelcomeText1ViewController* imageViewController =
            [[WelcomeText1ViewController alloc] initWithNibName:text1Title bundle:nil];
            if (imageViewController != nil)
            {
                myCurrentViewController = imageViewController;  
            }

    // embed the current view to our host view
    [myTargetView addSubview: [myCurrentViewController view]];

    // make sure we automatically resize the controller's view to the current window size
    [[myCurrentViewController view] setFrame: [myTargetView bounds]];

}


- (NSViewController*)viewController
{
    return myCurrentViewController;
}

@end

该消息表示nib没有将任何东西连接到视图控制器的
视图
出口

在nib中,确保文件所有者的自定义类设置为
WelcomeMainViewController
。然后确保文件所有者的
视图
出口连接到nib的顶级视图