类别(类型)与类别之间的关系用于界面生成器视图的 IBOutlet
我只是想确认我的理解是否正确,在 Interface Builder 中,类标识下设置的类(在 name.xib 摘要窗口中的 Type 下列出)是视图的类,而在 IBOutlet Class *viewName 中列出的类描述了与 Interface Builder 连接的性质,这是正确的吗?
例如
名称__________________________________类型
文件所有者__________________SomeViewController
第一响应者____________________UIResponder
MyLabel____________________________UILabel
。
IBOutlet UILabel *lblMyLabel
UILabel 是标签的类,IBOutlet UILabel 是代码和 IB 对象之间的连接类型,对吧?
我问是因为我子类化了 UIImageView &更新了视图的类,但将 IBOutlet 声明保留为 IBOutlet UIImageView 并且它仍然有效,因此我假设 IBOutlet 部分只是一个描述或指南。
I just want to confirm that I'm understanding correctly, in Interface Builder the Class set under Class Identity (listed under Type in the name.xib summary window) is the class of the view whereas in IBOutlet Class *viewName the class listed describes the nature of the connection to Interface Builder, is this correct?
e.g.
Name__________________________________Type
File's Owner_______________________SomeViewController
First Responder____________________UIResponder
MyLabel____________________________UILabel
.
IBOutlet UILabel *lblMyLabel
UILabel is the class of the label and IBOutlet UILabel is the type of connection between the code and the IB object, right?
I ask because I subclassed UIImageView & updated the view's class but left the IBOutlet declaration as IBOutlet UIImageView and it still works so I assume the IBOutlet part is just a description or a guideline.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在谈论像这样放入类的 @interface 部分中的 IBOutlet 关键字:
,这会告诉 Interface Builder 您将使用该类成员连接到 Interface Builder 中的“SomeOtherClass”对象。编写此成员后,您将能够将此对象的连接拖动到界面生成器中的“SomeOtherClass”对象,并选择“myObj”出口,并且当在运行时读取 .nib 时,您将拥有对象及其之间的联系可用。
您提到的“UILabel”确实是对象的类。
if you are speaking about the IBOutlet keyword that you put in the @interface part of the class like this:
, this tells Interface Builder that you will use this class member to connect to o a "SomeOtherClass" object in Interface Builder. After you write this member, you will be able to drag a connection from this object to a "SomeOtherClass" object in interface builder and select the "myObj" outlet, and when the .nib will be read at runtime, you will have both the objects and the connection between them available.
The "UILabel" that you mentioned is indeed the class of the object.