Changing dock icon on the fly a lot = molasses?
Changing dock icon on the fly a lot = molasses?
- Subject: Changing dock icon on the fly a lot = molasses?
- From: Craig Hunter <email@hidden>
- Date: Thu, 07 Sep 2006 11:36:48 -0400
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).
I am using the dock icon as a progress/status display that changes about
every 5 seconds, so over days of running the app there can be tens of
thousands of calls to change the dock icon. Is this slowdown expected (ie,
am I doing something totally unreasonable), or could I be handling this
better? I have tried profiling with Shark to see if I could tell what was
slowing down, but haven't really been able to pin it down. The only thing I
know for sure is that not calling this subroutine every 5 seconds eliminates
the problem. I am also badging the dock icon with a few simple drawing
operations after the icon change, but have eliminated that as a cause.
OS X's Activity Monitor is changing it's doc icon every few seconds with no
apparent ill effects over the long haul, so obviously it's possible to do
this right. If anyone has ideas, I would appreciate it.
Thanks,
Craig
--
Dr. Craig Hunter
NASA Langley Research Center
Configuration Aerodynamics Branch
email@hidden
(757) 864-3020
_______________________________________________
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