Search code examples
objective-cxcodedelegatesibaction

Delegate and IBAction


They seem to accomplish the same thing in Objective C. What can one do without the other?


Solution

  • For example:

    • Delegate methods can have return values.
    • There can be multiple targets for the same action, but usually only one delegate.
    • The target-action mechanism is (semantically, not strictly) bound to predefined control events such as "value changed", "touch up", etc. Delegate methods can be anything.
    • Delegate methods can have arbitrary arguments. Action methods always have the same arguments (sender and event, both optional).