Re: Drawing NSTextFieldCell subclass in table view
Re: Drawing NSTextFieldCell subclass in table view
- Subject: Re: Drawing NSTextFieldCell subclass in table view
- From: Patrick Mau <email@hidden>
- Date: Sun, 14 Dec 2008 01:26:02 +0100
On 13.12.2008, at 23:11, Andre Masse wrote:
Hi,
I want to display a cell like mail's message count in a table view
but with a fixed size and centered on both axes. I've created a
NSTextFieldCell subclass and its doing fine except that it draws in
the first row only, which could mean I'm drawing at the wrong
coordinates. Obviously, this is not what I want :-)
Drawing without modifying the cellFrame (commenting out the first 2
lines and changing the argument to "frame") produces the expected
result: a nice oval in every row but filling the entire cell space...
Any help, pointer to doc or tutorial are welcome.
Thanks,
Andre Masse
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
// we want 36x20
CGFloat y = cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);
Hi Andre
It seems you are not using the cellFrame.origin.y when you create your
new frame.
CGFloat y = cellFrame.origin.y + cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);
Regards,
Patrick
_______________________________________________
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