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 (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