Re: custom cell drawing
Re: custom cell drawing
- Subject: Re: custom cell drawing
- From: Nick <email@hidden>
- Date: Sat, 01 Mar 2003 12:48:29 -0500
Thanx. That fixed it. This is the first time I have dealt with drawing.
However, I am still confused. Is the frame information passed to the
cell relative or global to the superview?
Actually when I think about it, "fromRect" means relative to the frame
of the image. Now I get your point and where my mistake was.
Thank you again!
Nick
On Saturday, March 1, 2003, at 12:27 PM, Greg Titus wrote:
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.