objective c - How to slowly fill the NSProgressIndicator (Progress Bar) from 0 to 100? -


task: take progress bar (nsprogressindicator) 0 100 smoothly.

problem: progress bar getting 0 100 not smoothly.

what have done yet:

    // scan click on prgress should start -(void)scannowclick:(id)sender {         // setting initial value of progress bar         [progressbar setdoublevalue:0];         // starting timer         [nstimer scheduledtimerwithtimeinterval:0.5                                          target:self                                        selector:@selector(callafter10sec:)                                        userinfo:nil                                         repeats:yes];   }  // timer update progress bar -(void)callafter10sec:(nstimer *)time {      double value = [progressbar doublevalue]+10;      [[progressbar animator] setdoublevalue:value];      if(value >= 100)     {        [time invalidate];     } } 

/// layer set

enter image description here

you should use cadisplaylink , not nstimer when dealing ui related updates.

the link called 60 times per second (per refresh rate of screen)

in callback should calculate proportion advance view


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -