• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Strange NSCell subclass issue ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange NSCell subclass issue ...


  • Subject: Re: Strange NSCell subclass issue ...
  • From: Benjamin Stiglitz <email@hidden>
  • Date: Tue, 31 Mar 2009 14:54:36 -0400
  • Mail-followup-to: email@hidden

On Tue, Mar 31, 2009 at 07:37:03PM +0100, Mic Pringle wrote:
> Hi,
>
> I have subclassed NSCell and implemented only the following method ...
>
> - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
> {
> 	NSImage *separator = [NSImage imageNamed:@"Separator.png"];
> 	[separator setScalesWhenResized:YES];
> 	[separator setFlipped:YES];
> 	NSGraphicsContext *context = [NSGraphicsContext currentContext];
> 	[context saveGraphicsState];
> 	NSImageInterpolation interpolation = [context imageInterpolation];
> 	[context setImageInterpolation:NSImageInterpolationHigh];
> 	[separator setSize:NSMakeSize(cellFrame.size.width, 2.0f)];
> 	[separator drawInRect:NSMakeRect(cellFrame.origin.x,
> cellFrame.size.height - 10.0f, cellFrame.size.width, 2.0f)
> 				 fromRect:NSZeroRect
> 				operation:NSCompositeSourceOver
> 				 fraction:1.0f];
> 	[context setImageInterpolation:interpolation];
> 	[context restoreGraphicsState];
> }
>
> I have then subclassed NSTableView and set the dataCell of the first
> column to the above subclass.
>
> All works fine, except for the fact that the image drawn (separator)
> in the drawWithFrame method is only drawn in the very first cell. I
> have three rows displayed in the table view, and can clarify this as I
> can click on them and get the blue highlight.
>
> Any ideas as to why this would only draw the first cell and not all three ?

Your y coordinate is based off of the height instead of the top; see
NSMin/NSMaxY.

-Ben
_______________________________________________

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

References: 
 >Strange NSCell subclass issue ... (From: Mic Pringle <email@hidden>)

  • Prev by Date: Re: [BUG] Cursor Flicker
  • Next by Date: Re: Programmatically opened NSPanel not responding to actions
  • Previous by thread: Strange NSCell subclass issue ...
  • Next by thread: Programmatically opened NSPanel not responding to actions
  • Index(es):
    • Date
    • Thread