Anthony Glyadchenko
Anthony Glyadchenko

Reputation: 3622

When should I make a referencing outlet for a UI control and when just an event? (iPhone SDK)

I have some code that works without having referencing outlets for the controls - just event ties in Interface Builder. Is this ok and is a referencing outlet only necessary to change the state of a UI control?

Thanks.

Upvotes: 0

Views: 456

Answers (1)

Rob Napier
Rob Napier

Reputation: 299345

Correct. If your object doesn't need to reference the UI element, there is no reason to bind it with an IBOutlet. IBActions pass the sending UI element as their parameter, and you're free to use that to modify the state of an element as well, rather than using an IBOutlet.

Upvotes: 3

Related Questions