使用NSView加载Xib文件 [英] Load Xib Files with NSView

查看:76
本文介绍了使用NSView加载Xib文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MainMenu.xib中有一个自定义视图,它将包含2个子视图.这些子视图应从具有单个NSView的一些xib文件中加载.我怎样才能做到这一点?对于每个xib包含IBOutlet和IBAction的类,应从哪个类继承?对于每个Xib,我必须将文件所有者设置为包含插座/动作的类吗?

I've a Custom View in MainMenu.xib which will contains 2 subviews. These subviews should be loaded from some xib files which have a single NSView. How can i do this? The Classes that contains IBOutlet and IBActions for each xib from which class should inherit? And for each xib i must set the file owner to the Class that contains outlet/actions?

推荐答案

您的自定义视图或主菜单的头文件应#include您提到的2个子视图,并且应将它们列为IBOutlet成员和IBOutlet属性.(不要忘记合成!)

Your custom view or main menu's header file should #include the 2 subviews that you mention, and you should list them as IBOutlet members and IBOutlet properties. (don't forget to synthesize!)

在xib文件中,您应该能够拖入2个NSView,然后将其类设置为2个子类,然后通过从文件的所有者"拖动到对象"列表中的对象来链接它们.

In your xib file, you should be able to drag in 2 NSView's and then set their class to your 2 subclasses, and then link them by dragging from 'file's owner' to the object in the 'objects' list.

这篇关于使用NSView加载Xib文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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