I. Savant: 
> You don't get a reference to a cell. You tell the table view (via a 
> delegate method) what prototype cell to use for the requested col/row. 
> See: 
>  -[NSTableView tableView:dataCellForTableColumn:row:] 


I took a look at that but it really seems to complicate things. Basically, I 
create the table and bind it to it's data source programatically. Once the 
table is bound and added to a view, the row count is known, so all I need to do 
is set that one cell.  


I got part way there by doing: 


// create an array controller 




NSArrayController *controller = [[NSArrayController alloc] init]; 




[controller bind: @"contentArray" toObject: model withKeyPath: @"sites" 
options: nil ]; 





// create the table and bind the columns 





[name bind: @"value" toObject: controller withKeyPath: @"arrangedObjects.name" 
options: nil ]; 


// get reference to the last cell in the desired column 




int  rowIndex = [[controller arrangedObjects] count] - 1 ; 

id  cell = [[table tableColumnWithIdentifier: @"delete" ] dataCellForRow: 
rowIndex]; 




[cell setImage: [PMImages addButtonOrange]]; 

[cell setAlternateImage: [PMImages addButtonWhite]]; 

[cell setAction: @selector (handleAdd:)]; 




Which works, only problem is, it changes the image and target for every cell in 
the column. 



Is there no other way to do this other than ditching my table creation code 
completely and using a delegate? As above two lines indicate, this kind of 
thing should be trivial to do directly, provided there is some way to set the 
data cell. 



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to