在xCode中,我收到错误“加载笔尖但视图插座未设置”? [英] In xCode, I'm getting the error "Loaded the nib but the view outlet was not set"?

查看:137
本文介绍了在xCode中,我收到错误“加载笔尖但视图插座未设置”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有多个问题要求同样的事情,但他们的解决方案都不适合我。

I know there are multiple questions asking the same thing, but none of their solutions worked for me.

我做了一个自定义的viewController类(Home),我分别制作.xib。 (实际上,我将有2个笔尖 - 一个用于加载ipad版本,另一个用于iphone)。

I made a custom viewController class (Home), and I made a .xib separately. (Effectively, I'll have 2 nibs -- one for the ipad version to load, and another for the iphone).

当我尝试实例化一个实例时家庭类,我得到了我在问题中提到的错误。

When I try to instantiate an instance of the home class, I got the error I mentioned in the question.

在xib文件中,我所做的就是将一个viewcontroller对象从库拖到屏幕上,在文件所有者和第一个响应者下面自动添加了一个viewcontroller图标。然后我进入viewController对象的检查器,并将类从viewController更改为Home。

In the xib file, all I did was drag a viewcontroller object from the library to the screen, and it automatically added a viewcontroller icon below the file's owner and the first responder. I then went into the inspector of the viewController object and changed the class from viewController to Home.

我从解决方案中看到的下一步是连接检查器的视图插座。我不完全确定我应该把它连接到什么地方。我发现的解决方案是将它连接到视图图标,但我再次看到的只是文件所有者,第一响应者和vc对象。它连接到它们都没有

The next step that I've discerned from the solutions is to connect the view outlet from the inspector. I'm not entirely sure what I'm supposed to be connecting it to. The solutions I've found say to connect it to the view icon, but again, all I see is files owner, first responder, and the vc object. It connects to none of them

这是我在应用代理中放入的内容

Here is what I put in the app delegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

 Home *homePage = [[Home alloc] initWithNibName:@"HomeIpad" bundle:nil]; 

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:homePage];
[self.window addSubview:navController.view];
[self.window makeKeyAndVisible];
return YES;
}


推荐答案

问题在于文件的所有者,我没有将课程设置为Home

the problem was that for the file's owner, i hadn't set the class to Home

这篇关于在xCode中,我收到错误“加载笔尖但视图插座未设置”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆