views:

181

answers:

1

I have a few methods inside my view controller that load up for future actions, I call them all within a single method so ie:

- (void) updateSongInformation {
     artistName.text = @"Testing";
     [self setupEmail];
     [self checkStatus];
}

If I take out the last 2 lines, the UILabel is updated instantaneously. Is there a way to run the last 2 methods in the background so the user experience isn't delayed?

+8  A: 

performSelector:withObject:afterDelay: will let you push the calls to a later runloop cycle.

If those two calls take a substantial amount of time that will just make the UI unresponsive slightly later though, which may not be what you want. In that case, you'd need to either break the operations into small pieces and keep using performSelector:withObject:afterDelay: to do the next piece, or push the work onto a background thread.

smorgan
+1, better than a timer
Jesse Beder