On Jul 29, 2010, at 4:17 AM, Ken Thomases wrote:

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

(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


Thanks Ken.
Ok, i see that the method signature above is one with multiple parameters like this one in the ObjC documentation:
[myRectangle setOriginX: 30.0 y: 50.0];

Now that I have understood this, I feel that the following statements are unnecessary when I am having only one column in my application:

        NSString *identifier = [aTableColumn identifier];

  // Set the value for the attribute named identifier
[newVar setValue:anObject forKey:identifier];

Merely,

[toDoList objectAtIndex:rowIndex];

is enough for my needs.

But I don't understand what

[toDoList objectAtIndex:rowIndex];

means.

(toDoList is my array containing strings)



And does it have anything to do with:
- (id)tableView:(NSTableView *) tv
objectValueForTableColumn:(NSTableColumn *)tableColumn
                        row:(int)row
{
    NSString *v = [toDoList objectAtIndex:row];
    return v;
}

_______________________________________________

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