Re: custom cell drawing
Re: custom cell drawing
- Subject: Re: custom cell drawing
- From: Greg Titus <email@hidden>
- Date: Sat, 1 Mar 2003 09:27:10 -0800
On Saturday, March 1, 2003, at 09:05 AM, Nick wrote:
Hello, folks.
Have an interesting and annoying problem.
I have inherited NSCell to do some custom drawing in a NSTableView. The
text renders fine, however, the images do not. Every single cell has an
image and a little bit of text. However, after the first row, the
images will not render in the NSTableView.
- (void) drawWithFrame: (NSRect ) frame inView: (NSView *) view
{
NSRect r;
r = frame;
r.size.width= 39;
r.size.height = 39;
[im drawAtPoint: p fromRect: r operation: NSCompositeSourceAtop
fraction: 1.0];
Thanks a lot for the help. I really cannot figure it out.
Imagine you are passed in the frame of the second row, so
frame.origin.y = 40 or so. You assign that to your rectangle "r", so
you are trying to draw the portion of your image that starts at y = 40.
But the image is only 39 pixels high, so it draws nothing.
Instead of the "r = frame;" line, you should just set "r.origin.x = 0;
r.origin.y = 0;".
Hope this helps,
- Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.