nonopolarity
nonopolarity

Reputation: 151036

In Xcode's Interface Builder, isn't outlet the same as properties, and action the same as event handler?

It seems that using Xcode's Interface Builder, when we Ctrl-drag the control to the header file, what we create as outlet is very similar to a webpage's element's properties (attributes), and what we create as action is very similar to event handlers. Is that true?

I also wonder why we need to Ctrl-drag the control to the header file, under @interface, instead of just right click on it and choose either "Add outlet" or "Add action". Why to we have to drag it to an exact place in the header file?

Upvotes: 0

Views: 150

Answers (1)

Nikita Pestrov
Nikita Pestrov

Reputation: 5966

Actually, we don't need to drag it with Ctrl, this is just for ease of using.We can also link our outlets in code.

And, yes, it is really similar to properties. You even can declare it as properties in your @interface

@property (strong)IBOutlet UITextField *loginField;

Here's a good talk on this subject https://groups.google.com/forum/m/?fromgroups#!topic/pdx-cocoaheads-talk/ujqrcCZc-Z8

Upvotes: 2

Related Questions