objective c - Show, activate and stop indetermined progress indicator -
i'm having issues showing progress indicator whenever button clicked, , stop , hide indicator when nstask completed.
this should timeline: 1- button clicked 2- shows progress indicator (from hidden state) 3- activates progress indicator 4- activate associated nstask 5- continue showing indicator until nstask completed 6- after completion of nstask, hide progress indicator.
i know how progress indicator animate etc. not know how combine these nstask completing thing..
thanks in advance!
use nstask's terminationhandler property set block execute when task terminates. in block stop/hide progress indicator.
addendum (see comments)
in rough outline:
nstask *mytask = ...; nsprogressindicator *myindicator = ...; mytask.terminationhandler = ^(nstask *thetask) { [myindicator stopanimation:nil]; }; note handler passed nstask in case needs access information it. nil passed sender stopanimation: - pass self cause retain cycle , object invoking method isn't important.
Comments
Post a Comment