0
这适用于Mac应用程序,不适用于iPhone。我想要做的是将我当前的xib“欢迎屏幕”打开,然后在名为myTargetView的自定义视图中加载另一个xib“WelcomeScreenText1”。当它运行错误消息是“[NSViewController loadView]加载了”WelcomeScreenText1“xib但没有设置视图。”请帮忙!在自定义视图中加载Xcode
#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
谢谢,忘记了! –