objective c - NSStatusItem draw animation when highlighted -


i'm using nsstatusitem in project , want animated when program running. works fine when item not selected. when i'm clicking on image freezing. trying set alternate image timer no result. latest idea draw nsview on nsstatusitem no result well.

- (void)startanimating {     currentframe = 1;     animtimer = [nstimer scheduledtimerwithtimeinterval:1.0/15.0 target:self selector:@selector(updateimage:) userinfo:nil repeats:yes]; }  - (void)stopanimating {     [animtimer invalidate]; }  - (void)updateimage:(nstimer*)timer {     if (currentframe == 13)     {         currentframe = 1;     }     nsimage* image;     if ([window backingscalefactor] == 1.0)     {         image = [nsimage imagenamed:[nsstring stringwithformat:@"app_18_gr_%d",currentframe]];         nsrect rect = [[statusitem view] frame];         [image drawinrect:[[statusitem view] frame] fromrect:nszerorect operation:nscompositesourceover fraction:1.0];         [image settemplate:yes];     }     else     {         image = [nsimage imagenamed:[nsstring stringwithformat:@"app_36_gr_%d",currentframe]];         [image drawinrect:[[statusitem view] frame] fromrect:nszerorect operation:nscompositesourceover fraction:1.0];         [image settemplate:yes];     }     [statusitem setimage:image];     currentframe++; } 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -