• 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: cocoa-dev digest, Vol 2 #1410 - 12 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cocoa-dev digest, Vol 2 #1410 - 12 msgs


  • Subject: Re: cocoa-dev digest, Vol 2 #1410 - 12 msgs
  • From: Andrew Merenbach <email@hidden>
  • Date: Sun, 20 Oct 2002 15:38:08 -0700

If you have a lot of buttons, it is often much better to use a matrix of NSButtonCells, which speeds things up considerably.

Take care,
Andrew Merenbach

On Saturday, October 19, 2002, at 10:00 PM, email@hidden wrote:

Drawing NSButtons is way too slow. Drawing the background image and
the text takes too long.

I would like to subclass NSButton and do something like...

- (void)drawRect:(NSRect)rect;
{
if (!_cachedImage)
{
_cachedImage = [[NSImage alloc] initWithSize:rect.size];

[_cachedImage lockFocus];

// draw the NSButton in the NSImage
[super drawRect:rect];

[_cachedImage unlockFocus];
}

[_cachedImage compositeToPoint:rect.origin
operation:NSCompositeSourceOver];
}

This almost works, but the image doesn't look right. I've tried all
the obvious solutions and couldn't make this work.

When I resize my window, 10% of the time is spent redrawing simple
NSButtons!
_______________________________________________
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.

  • Prev by Date: BSD events on NSRunLoop?
  • Next by Date: Re: How to make a NSMatrix with NSImageCell's ??
  • Previous by thread: Re: BSD events on NSRunLoop?
  • Next by thread: Promised Drag/Thread Conundrum
  • Index(es):
    • Date
    • Thread