ios - Tableview reload with setNeedsDisplay not working -


i have tableview in view lists steps executed. want show step marked when step executed. problem facing tableview not refresh until procedure executed steps. consequently steps show marked @ same time.

this function starts running when user presses button:

-(void)initialiseer {     //do first step     [self.mytableview reloaddata];     [self.myview setneedsdisplay];      //do second step     [self.mytableview reloaddata];     [self.myview setneedsdisplay];      //do third step     [self.mytableview reloaddata];     [self.myview setneedsdisplay]; } 

myview view iboutlet. mytableview tableview iboutlet. tried [self.view setneedsdisplay] , [self. mytableview setneedsdisplay] not work either. tried getting cell tableview , making changes on cell itself. nothing refreshed until procedure finished executing completely...

can tell me doing wrong? new ios development , searched, read, tried... did not find answer far.

i think need read on run loop , setneedsdisplay (which don't think you're expecting). basically, ui not updated until code finishes executing. pattern need displaying complex calculation this:

-(void)initialiseer {   dispatch_async(dispatch_get_global_queue(qos_class_background, 0), ^{     //do first step      dispatch_sync(dispatch_get_main_queue(), ^{       [self.mytableview reloaddata];     });      //do second step     dispatch_sync(dispatch_get_main_queue(), ^{       [self.mytableview reloaddata];     });      //do third step     dispatch_sync(dispatch_get_main_queue(), ^{       [self.mytableview reloaddata];     });   }); } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -