Re: Need recommendations for best way to build a custom view
Re: Need recommendations for best way to build a custom view
- Subject: Re: Need recommendations for best way to build a custom view
- From: Ken Tozier <email@hidden>
- Date: Fri, 20 Feb 2009 03:48:37 -0500
On Feb 19, 2009, at 9:59 PM, Kyle Sluder wrote:
And have you set a breakpoint to see if your code is taking that
path for all columns?
I didn't try breakpoints but the NSLogs do the same thing and indicate
that if you assign cells based on nil columns, from that point onward
you are never again passed a valid column in the
"dataCellForTableColumn" field. None of the other NSLogs are ever
executed.
Below the latest tableView:dataCellForTableColumn:row: rev. and here's
what I'm seeing in the console when my app runs
2009-02-20 03:40:35.859 Widget Lab[50885:10b] inTableColumn: (null),
colunn count: 3
2009-02-20 03:40:35.861 Widget Lab[50885:10b] inTableColumn: (null),
colunn count: 3
2009-02-20 03:40:35.863 Widget Lab[50885:10b] inTableColumn: (null),
colunn count: 3
etc...
- (NSCell *) tableView:(NSTableView *) inTableView
dataCellForTableColumn:(NSTableColumn *) inTableColumn
row:(NSInteger) inRow
{
NSString *columnIdentifier = [inTableColumn identifier],
*cellType = [[[testController arrangedObjects] objectAtIndex:
inRow] objectForKey: @"cell_type"];
NSLog(@"inTableColumn: %@, colunn count: %i", inTableColumn,
[inTableView numberOfColumns]);
if (inTableColumn == nil)
{
return pageNumberCell;
}
else if ([columnIdentifier isEqualToString: @"delete"])
{
NSLog(@"delete table column");
return [cellType isEqualToString: @"project"] ? addCell : deleteCell ;
}
else if ([columnIdentifier isEqualToString: @"page_number"])
{
NSLog(@"page number table column");
return [cellType isEqualToString: @"project"] ? projectNameCell :
pageNumberCell ;
}
else if ([columnIdentifier isEqualToString: @"master"])
{
NSLog(@"master table column");
return [cellType isEqualToString: @"project"] ? dummyCell :
masterPageCell ;
}
else
{
NSLog(@"inTableColumn: %@", inTableColumn);
return [inTableColumn dataCellForRow: inRow];
}
}
After fighting this for several more hours, I'm throwing in the towel
and am going to live with the editable project name cells and stupidly
wide page number cells. It's just not worth the time or effort trying
to figure out what precise sequence of incantations Apple requires to
customize an NSTableView to do what I want.
Thanks for the tips though. "tableView:isGroupRow:" seemed to get me
several steps closer and I may return to this at some point when I'm
not so frustrated.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden