multithreading - Animation After Background Thread Complete (iOS / Swift) -


i'm looking animate few things when long process (parsing) complete. barebones code looks such:

func run_on_background_thread(code: () -> void) {     dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), code) }  func run_on_main_thread(code: () -> void) {     dispatch_async(dispatch_get_main_queue(), code) }  func manage_response() {     run_on_background_thread     {         long_process()         run_on_main_thread         {             uiview.animatewithduration(animation_duration, delay: 0, usingspringwithdamping: 0.8, initialspringvelocity: 0.8, options: uiviewanimationoptions.curveeaseinout, animations:                 {                     some_view.transform = cgaffinetransformmakescale(0, 0)                 }, completion: nil)         }     } } 

quite obviously, animation not occur. ui updates final stage. proper way thread (i know animatewithduration() dispatch's it's own thread, don't know how hold animation until long process complete.

thanks.

i think u way can work. change

some_view.transform = cgaffinetransformmakescale(0, 0) 

to :

some_view.transform = cgaffinetransformmakescale(0.01, 0.01) 

change scale value close zero; u can see animation occur. if scale value == 0,there no animation occur. u can try this.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -