Re: Changing dock icon on the fly a lot = molasses?
Re: Changing dock icon on the fly a lot = molasses?
- Subject: Re: Changing dock icon on the fly a lot = molasses?
- From: Matt Neuburg <email@hidden>
- Date: Thu, 07 Sep 2006 12:00:29 -0700
- Thread-topic: Changing dock icon on the fly a lot = molasses?
On Thu, 07 Sep 2006 11:36:48 -0400, Craig Hunter <email@hidden>
said:
>I have been using this simple function to change the dock icon in an app:
>
>#import "DockIcon.h"
>@implementation NSApplication (DockIcon)
> - (void)DockIcon:(NSString *)theIcon
> {
> [NSApp setApplicationIconImage:[NSImage imageNamed:theIcon]];
> }
>@end
>
>Where "DockIcon.h" is:
>
>#import <AppKit/AppKit.h>
>@interface NSApplication (DockIcon)
> - (void)DockIcon:(NSString *)theIcon;
>@end
>
>
>It works fine, but I notice that my app starts to feel slower and less
>responsive with a lot of these calls over a long period of time (days).
Here is the code I use in my MemoryStick app, which redraws the dock icon
every few seconds:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApp setApplicationIconImage: [self dockIcon]];
[pool release];
I found that without the autorelease pool, setApplicationIconImage generated
leaks. HTH - m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden