开发者

Relation between Class (Type) & IBOutlet for Interface Builder Views

开发者 https://www.devze.com 2022-12-27 06:19 出处:网络
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 vie开发者_JS百科

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 vie开发者_JS百科w 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.


if you are speaking about the IBOutlet keyword that you put in the @interface part of the class like this:


@interface Myclass {
  IBOutlet SomeOtherClass *myObj;
}

, 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号