File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -265,9 +265,13 @@ - (void)myMixedTask {
265265 HUD.mode = MBProgressHUDModeIndeterminate;
266266 HUD.labelText = @" Cleaning up" ;
267267 sleep (2 );
268- // The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
269- // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators)
270- HUD.customView = [[[UIImageView alloc ] initWithImage: [UIImage imageNamed: @" 37x-Checkmark.png" ]] autorelease ];
268+ // UIImageView is a UIKit class, we have to initialize it on the main thread
269+ __block UIImageView *imageView;
270+ dispatch_sync (dispatch_get_main_queue (), ^{
271+ UIImage *image = [UIImage imageNamed: @" 37x-Checkmark.png" ];
272+ imageView = [[UIImageView alloc ] initWithImage: image];
273+ });
274+ HUD.customView = [imageView autorelease ];
271275 HUD.mode = MBProgressHUDModeCustomView;
272276 HUD.labelText = @" Completed" ;
273277 sleep (2 );
You can’t perform that action at this time.
0 commit comments