Adjusting NSTableView row height for custom fonts
Adjusting NSTableView row height for custom fonts
- Subject: Adjusting NSTableView row height for custom fonts
- From: Matt Judy <email@hidden>
- Date: Wed, 09 Jan 2002 21:46:37 -0800
Hello,
I'm allowing the user to select the font for browsing a list in an
NSTableView. I'm setting the font in the tableView's dataSource:
- (void)tableView:(NSTableView *)aTableView
willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
if ([aCell respondsToSelector:@selector(setFont:)]) {
NSFont *font = [preferences browseTableFont];
[aCell setFont:font];
}
...
}
When I do this, I have 2 problems.
1-) Even if I use the default font (Lucida Grande 13pt), it is drawn in
the cell below middle. NSCell doesn't seem to have a method for setting
vertical alignment.
2-) The cell height is too small to display large fonts. I can use
setRowHeight: to adjust the height of the cells, but the centering thing
is still a problem.
I'm assuming there's a nice implementation already in use out there...
How have you guys been doing this?
Thanks.
--Matt Judy