iOS Updating UI when using blocks / background threads

Here is the method that I use to update the UI when a background async thread. This is mostly for my own reference:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        //background processing goes here
        dispatch_async(dispatch_get_main_queue(), ^{
                //update UI here
        });
});
Advertisements

One thought on “iOS Updating UI when using blocks / background threads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s