Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed threading bug in the myMixedTask demo.

  • Loading branch information...
commit b157ecb0ac5ea160aeb14d1319f267f2efb43bd9 1 parent fdd147f
@matej matej authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 Demo/Classes/HudDemoViewController.m
View
10 Demo/Classes/HudDemoViewController.m
@@ -265,9 +265,13 @@ - (void)myMixedTask {
HUD.mode = MBProgressHUDModeIndeterminate;
HUD.labelText = @"Cleaning up";
sleep(2);
- // The sample image is based on the work by www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/
- // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators)
- HUD.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]] autorelease];
+ // UIImageView is a UIKit class, we have to initialize it on the main thread
+ __block UIImageView *imageView;
+ dispatch_sync(dispatch_get_main_queue(), ^{
+ UIImage *image = [UIImage imageNamed:@"37x-Checkmark.png"];
+ imageView = [[UIImageView alloc] initWithImage:image];
+ });
+ HUD.customView = [imageView autorelease];
HUD.mode = MBProgressHUDModeCustomView;
HUD.labelText = @"Completed";
sleep(2);
Please sign in to comment.
Something went wrong with that request. Please try again.