Tuesday, 13 November 2012

Messages


To get an object to do something, you send it a message telling it to apply a method. In Objective-C, message expressionsare enclosed in square brackets:
    [receiver message]
The receiver is an object, and the message tells it what to do. In source code, the message is simply the name of a method and any arguments that are passed to it. When a message is sent, the run-time system selects the appropriate method from the receiver's repertoire and invokes it.
For example, this message tells the myRect object to perform its display method, which causes the rectangle to display itself:
    [myRect display];

0 comments:

 
© Copyright 2035 iOS Developer
Theme by Yusuf Fikri