Re: Table view containing cells with both an image and text
Re: Table view containing cells with both an image and text
- Subject: Re: Table view containing cells with both an image and text
- From: Corbin Dunn <email@hidden>
- Date: Wed, 10 Dec 2008 14:32:21 -0800
On Dec 10, 2008, at 2:15 PM, Randall Meadows wrote:
On Dec 10, 2008, at 2:41 PM, Corbin Dunn wrote:
On Dec 10, 2008, at 1:14 PM, Randall Meadows wrote:
- the cellFrame passed into -drawInteriorWithFrame:inView: is not
really the interior of the frame; I've had to do
No; it really is!
You're this >< close to convincing me! :)
It really is; I promise :)
cellFrame.origin.x -= 1, cellFrame.origin.y -= 1,
cellFrame.size.width += 3, cellFrame.size.height += 1;
Yeah, you don't want to do this; you will have re-draw issues when
the cell is invalidated. It sounds like you want to set the -
intercellSpacing to 0,0, or override the -drawRow/drawRect method
and first fill in the area with a solid background color.
Essentially, what you are doing is undoing the intercell spacing.
OK, I set intercellSpacing to (0,0), take out my hack, and:
(gdb) p (NSSize)[controlView intercellSpacing]
$1 = {
width = 0, height = 0
}
(gdb) p (NSRect)[controlView bounds]
$2 = {
origin = {
x = 0, y = 0
},
size = {
width = 425, height = 460
}
}
(gdb) p (NSRect)aCellFrame
$3 = {
origin = {
x = 0, y = 0
},
size = {
width = 422, height = 18
}
}
Notice the cellFrame is still 3 pixels narrower than the table view
itself.
The cell's width is set to the width of the column it resides in. The -
width of the tablecolumn for that given cell is probably not large
enough.
Really, -frameOfCellAtColumn:row: will be equal to what is passed to -
drawRect:.. of the cell. You can subclass and change the rect returned
from the first thing to tweak the sizes (but don't change the row
height -- use the variable row height delegate method for that).
corbin
_______________________________________________
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