Skip to content

Commit

Permalink
Demo project enhancements.
Browse files Browse the repository at this point in the history
  • Loading branch information
matej committed Apr 29, 2011
1 parent c1cd3c8 commit f6b9d49
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 241 deletions.
20 changes: 11 additions & 9 deletions Demo/Classes/HudDemoViewController.m
Expand Up @@ -11,6 +11,9 @@

@implementation HudDemoViewController

#pragma mark -
#pragma mark Constants

#pragma mark -
#pragma mark Lifecycle methods

Expand Down Expand Up @@ -152,22 +155,24 @@ - (IBAction)showWithLabelMixed:(id)sender {
}

- (IBAction)showUsingBlocks:(id)sender {
#ifdef __BLOCKS__
// No need to retain (just a local variable)
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hud.labelText = @"Loading";

dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// Show the HUD in the main tread
dispatch_async(dispatch_get_main_queue(), ^{
// No need to hod onto (retain)
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hud.labelText = @"Loading";
});

// Do a taks in the background
[self myTask];
hud.labelText = @"Some more";
[self myTask];

// Hide the HUD in the main tread
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
});
});
#endif
}

- (IBAction)showOnWindow:(id)sender {
Expand All @@ -192,9 +197,6 @@ - (IBAction)showOnWindow:(id)sender {
- (void)myTask {
// Do something usefull in here instead of sleeping ...
sleep(3);
// Labels can be changed during the execution
//HUD.detailsLabelText = @"Something";
//sleep(3);
}

- (void)myProgressTask {
Expand Down
Binary file modified Demo/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Demo/Default@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions Demo/HudDemo.xcodeproj/project.pbxproj
Expand Up @@ -16,7 +16,8 @@
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
28D7ACF80DDB3853001CB0EB /* HudDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */; };
D22F7D810F85241C00550BB3 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = D22F7D800F85241C00550BB3 /* MBProgressHUD.m */; };
D277FDB311FC834200304321 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB211FC834200304321 /* Default.png */; };
D263D189136AFEFD00F41F81 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D263D188136AFEFD00F41F81 /* Default@2x.png */; };
D263D18B136B001E00F41F81 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D263D18A136B001E00F41F81 /* Default.png */; };
D277FDB911FC877E00304321 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB711FC877E00304321 /* Icon.png */; };
D277FDBA11FC877E00304321 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D277FDB811FC877E00304321 /* Icon@2x.png */; };
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */; };
Expand All @@ -38,6 +39,8 @@
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D22F7D7F0F85241C00550BB3 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MBProgressHUD.h; path = ../MBProgressHUD.h; sourceTree = SOURCE_ROOT; };
D22F7D800F85241C00550BB3 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MBProgressHUD.m; path = ../../MBProgressHUD.m; sourceTree = "<group>"; };
D263D188136AFEFD00F41F81 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
D263D18A136B001E00F41F81 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
D277FDB211FC834200304321 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
D277FDB711FC877E00304321 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
D277FDB811FC877E00304321 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -103,6 +106,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
D263D18A136B001E00F41F81 /* Default.png */,
D277FDBF11FC880100304321 /* UI */,
D277FDBD11FC879500304321 /* Images */,
8D1107310486CEB800E47090 /* Info.plist */,
Expand All @@ -123,9 +127,10 @@
D277FDBD11FC879500304321 /* Images */ = {
isa = PBXGroup;
children = (
D277FDB711FC877E00304321 /* Icon.png */,
D277FDB811FC877E00304321 /* Icon@2x.png */,
D263D188136AFEFD00F41F81 /* Default@2x.png */,
D277FDB211FC834200304321 /* Default.png */,
D277FDB811FC877E00304321 /* Icon@2x.png */,
D277FDB711FC877E00304321 /* Icon.png */,
D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */,
);
name = Images;
Expand Down Expand Up @@ -192,7 +197,8 @@
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
2899E5220DE3E06400AC0155 /* HudDemoViewController.xib in Resources */,
D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */,
D277FDB311FC834200304321 /* Default.png in Resources */,
D263D18B136B001E00F41F81 /* Default.png in Resources */,
D263D189136AFEFD00F41F81 /* Default@2x.png in Resources */,
D277FDB911FC877E00304321 /* Icon.png in Resources */,
D277FDBA11FC877E00304321 /* Icon@2x.png in Resources */,
);
Expand Down Expand Up @@ -225,6 +231,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = HudDemo_Prefix.pch;
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = HudDemo;
};
name = Debug;
Expand All @@ -237,6 +244,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = HudDemo_Prefix.pch;
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = HudDemo;
};
name = Release;
Expand Down

0 comments on commit f6b9d49

Please sign in to comment.