iphone - My activity Indicator show after my algorithm -


i have function onclickbutton (pseudocode):

show activityindicatorview (or progressbar or change label text no matter) execute algorithm hide activityindicatorview 

actvitiyindicatorview never show. if delete hide @ end of function, emerge after algorithm. in spite of show before execute algorithm.

why , how can fix ?

most execute algorithm long cpu time consuming process called on main thread...

you showing activity indicator before algorithm...the ui takes time update layout (adding activity indicator..) ..but before does..your a;gorith takes place on main thread..and block ui update.. when task completes.. tell hide activity..and activity hides....that why can't see being added , removed view..

to solve this..do algorithm task in separate thread(no main thread) ..this way ui updated , task complete in background..

alternative way perform long task after delay..so ui update itself


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -