Re: cocoa-dev digest, Vol 2 #1410 - 12 msgs
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.