Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>What does it mean when there's a sender parameter in a method header? Does it represent the instance that called it, or the method that called it?</p> </blockquote> <p>Look at the type of the argument. Chances are, it's <code>id</code>. That's the type of an object pointer. You're correct that it is the instance that sent the message.</p> <p>You can pass a <em>message selector</em> to a message, but the type for that is <code>SEL</code>, not <code>id</code>. Likewise, you can pass a <em>method implementation</em> to a message, but the type for that is <code>IMP</code>, not <code>id</code>.</p> <p>Methods that take a single <code>sender</code> argument are typically action methods, usually identified by the <code>IBAction</code> return type. As zoul said, <code>IBAction</code> expands to <code>void</code> for the compiler, which tells it that the method does not return a value. The reason to have <code>IBAction</code> is that Interface Builder looks for methods with <code>IBAction</code> as the return type and detects them as actions you can wire a control up to.</p> <p>For more information for Cocoa (Mac OS X), see <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html#//apple_ref/doc/uid/TP40002974-CH7-SW14" rel="nofollow noreferrer">“The Target-Action Mechanism” in the Cocoa Fundamentals Guide</a> and the <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ControlCell/" rel="nofollow noreferrer">Control and Cell Programming Topics for Cocoa</a>.<br> For more information for Cocoa Touch (iPhone/iPod touch/iPad), see <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIControl_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006779-RH2-SW28" rel="nofollow noreferrer">“The Target-Action Mechanism” in the UIControl class reference</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload