On Jul 28, 2010, at 1:27 PM, Rounak Jain wrote:

> I am comfortable with understanding method declarations like
> - (void) someName: (NSString *) variableName;
> where
> void is return type
> someName is name of the method

Close.  "someName:" _with the colon_ is the name of the method.  There's a 
difference between "someName" and "someName:".

> (NSString *) is the type of the variableName and variableName is the variable
> 
> However, I feel helpless when I see something like this:
> 
> - (void)tableView:(NSTableView *)aTableView
>   setObjectValue:(id)anObject
>   forTableColumn:(NSTableColumn *)aTableColumn
>              row:(int)rowIndex {
>       
>       NSString *identifier = [aTableColumn identifier];
>    data *newVar = [toDoList objectAtIndex:rowIndex];
>       
>    // Set the value for the attribute named identifier
> [newVar setValue:anObject forKey:identifier];
> }
> 
> All I know is that this method lets me put the content of array toDoList into 
> the TableView. Please give me a detailed breakdown of what this is.

Objective-C method signatures have the name broken up in pieces with the 
parameters between them.  They're like fill-in-the-blank sentences.

The method name here is tableView:setObjectValue:forTableColumn:row:.  Each 
colon is a blank in the sentence to be filled in by the invoker.  It has a void 
return.  Its parameters are: aTableView of type NSTableView*; anObject of type 
id; aTableColumn of type NSTableColumn*; and rowIndex of type int.

Does that help?  Have you read Apple's introductory documentation about 
Objective-C and Cocoa?

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to