ios - Update View from loop -
i have read several threads on topic, did not manage find answer yet. in ios app, downloading data soap webservice using classes provided sudzc.com. save data coredata database. so, have loop through sets of data (for-loop). there may lots of data, want provide status updates ui. saving managed webservicehelper class defines delegate push status information view controller. delegate set correctly of messages beeing displayed, did not manage update view inside loop or call delegate twice in 1 long running method.
tried performselector:withobject:afterdelay:
did not change anything.
there other way force ui update?
ui changes need go on main thread, , long-running operation should on background thread.
assuming loop running in background thread, can trigger ui updates this:
[[nsoperationqueue mainqueue] addoperationwithblock:^{ // update ui here }];
this execute block on main runloop. alternative use gcd apis, stay @ obj-c/foundation level if possible.
Comments
Post a Comment