From eedc69dc53126b95e1bf55242511f652e5ea14ca Mon Sep 17 00:00:00 2001 From: Matej Bukovinski Date: Sun, 25 Jul 2010 17:03:16 +0200 Subject: [PATCH] Class methods for quickly showing and hiding the HUD. Not using perform selectior when calling seterts from the main thread. Added an option to automatically remove the HUD from its parent view when hidden. Demo app updates: - GCD (blocks) example added - now using a scrollview - added a navigation controller - some project reorganization - Default.png - app icon - changed the bundle identifier --- Demo/Classes/HudDemoAppDelegate.h | 4 +- Demo/Classes/HudDemoAppDelegate.m | 6 +- Demo/Classes/HudDemoViewController.h | 1 + Demo/Classes/HudDemoViewController.m | 37 +- Demo/Default.png | Bin 0 -> 6208 bytes Demo/HudDemo.xcodeproj/project.pbxproj | 36 +- Demo/HudDemoViewController.xib | 664 ++++++++++++++++++------- Demo/Icon.png | Bin 0 -> 2982 bytes Demo/Icon@2x.png | Bin 0 -> 5470 bytes Demo/Info.plist | 2 +- Demo/MainWindow.xib | 486 ++++++++++++++++-- MBProgressHUD.h | 41 +- MBProgressHUD.m | 80 ++- 13 files changed, 1099 insertions(+), 258 deletions(-) create mode 100644 Demo/Default.png create mode 100644 Demo/Icon.png create mode 100644 Demo/Icon@2x.png diff --git a/Demo/Classes/HudDemoAppDelegate.h b/Demo/Classes/HudDemoAppDelegate.h index 2e36b0c..57629b4 100644 --- a/Demo/Classes/HudDemoAppDelegate.h +++ b/Demo/Classes/HudDemoAppDelegate.h @@ -12,11 +12,11 @@ @interface HudDemoAppDelegate : NSObject { UIWindow *window; - HudDemoViewController *viewController; + UINavigationController *navController; } @property (nonatomic, retain) IBOutlet UIWindow *window; -@property (nonatomic, retain) IBOutlet HudDemoViewController *viewController; +@property (nonatomic, retain) IBOutlet UINavigationController *navController; @end diff --git a/Demo/Classes/HudDemoAppDelegate.m b/Demo/Classes/HudDemoAppDelegate.m index 50a34d4..a68acde 100644 --- a/Demo/Classes/HudDemoAppDelegate.m +++ b/Demo/Classes/HudDemoAppDelegate.m @@ -12,19 +12,19 @@ @implementation HudDemoAppDelegate @synthesize window; -@synthesize viewController; +@synthesize navController; - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch - [window addSubview:viewController.view]; + [window addSubview:navController.view]; [window makeKeyAndVisible]; } - (void)dealloc { - [viewController release]; + [navController release]; [window release]; [super dealloc]; } diff --git a/Demo/Classes/HudDemoViewController.h b/Demo/Classes/HudDemoViewController.h index 85fc24c..ccb73cd 100644 --- a/Demo/Classes/HudDemoViewController.h +++ b/Demo/Classes/HudDemoViewController.h @@ -19,6 +19,7 @@ - (IBAction)showWithLabelDeterminate:(id)sender; - (IBAction)showWithCustomView:(id)sender; - (IBAction)showWithLabelMixed:(id)sender; +- (IBAction)showUsingBlocks:(id)sender; - (void)myTask; - (void)myProgressTask; diff --git a/Demo/Classes/HudDemoViewController.m b/Demo/Classes/HudDemoViewController.m index 6276db9..2283811 100644 --- a/Demo/Classes/HudDemoViewController.m +++ b/Demo/Classes/HudDemoViewController.m @@ -14,6 +14,11 @@ #pragma mark - #pragma mark Lifecycle methods +- (void)viewDidLoad { + UIView *content = [[self.view subviews] objectAtIndex:0]; + ((UIScrollView *)self.view).contentSize = content.bounds.size; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview // Release anything that's not essential, such as cached data @@ -26,6 +31,11 @@ return YES; } +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + UIView *content = [[self.view subviews] objectAtIndex:0]; + ((UIScrollView *)self.view).contentSize = content.bounds.size; +} + - (void)dealloc { [super dealloc]; } @@ -106,6 +116,10 @@ // The hud will dispable all input on the view HUD = [[MBProgressHUD alloc] initWithView:self.view]; + // 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]; + // Set custom view mode HUD.mode = MBProgressHUDModeCustomView; @@ -117,10 +131,6 @@ HUD.labelText = @"Completed"; - // 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]; - // This would only show the completed text with no visible custom view // HUD.customView = [[UIView alloc] initWithFrame:CGRectZero]; @@ -144,6 +154,25 @@ [HUD showWhileExecuting:@selector(myMixedTask) onTarget:self withObject:nil animated:YES]; } +- (IBAction)showUsingBlocks:(id)sender { + 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.view animated:YES]; + hud.labelText = @"Loading"; + }); + + // Do a taks in the background + [self myTask]; + + // Hide the HUD in the main tread + dispatch_async(dispatch_get_main_queue(), ^{ + [MBProgressHUD hideHUDForView:self.view animated:YES]; + }); + }); +} + #pragma mark - #pragma mark Execution code diff --git a/Demo/Default.png b/Demo/Default.png new file mode 100644 index 0000000000000000000000000000000000000000..1f8a9792e7bc314191a7562fcc081b40c1c00e5b GIT binary patch literal 6208 zcmeHLXH-*Zw+0KSR7a#sC?Y73gib3#p&~Tb-&L~GXzb?|j6>bc7aQ5?R zgDcU{92Z2GT3{{oZ$O<;NT9VM;97N^AV0!c zS%zRH5%b)nSf zZ_6M-{_ha1yRzWFin7o*;#WtZ;ry~du!Iv>4$Lnn36zwUk(ZYj=a&LYfj?#ca5x+gCk;fQT|tr%2;`fFl#~P& zA%XGpz&iL!cwmHnDrmqlPH2QD7J>5M|EB2Ri1NlN3sNinR|`nbKV&^HKemawVIW@z zPmm-K{H>**Kz;pxh9Z%FpfOlu_@DLux55}xKTkNw7>+@Cqn)UOa}oNM$`h)NhC5(U zXj2sG_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D(G}HkasKZdO|5UjcJl53VjJ}udjU!!I-7us_zR~J;4)O5Uj%*Kaw;%kwq%SX#j z*_m^8=58RH!-oLngjBxd3BG`X>|#0Bi@!|yj7z+-C7Udbn5}Hbggci$eps+T7jEf4 zGS6n07En*(zho_$NEyH|AHXk-VSLpnb#;E^(JcQxy0^tr67$C(p^f>{%~r zuRcLG2*|iFrKt`m*K-N&q$Sf9L+y{~r@tM~Ym-7Re?PFFJkbdO*9*vmg81z(+1tYa zYR8lEO{0b)E3xXlRe~+tZw2WChb4qq|y9J>Y*2LqlnQgjB!@ zMr!ySaEkLg{%1(V|DgYg|4C;Be^>kO=>L}PFZ4h0Kk5ATe@*wlSnZ$bel+|4)&9dM z|2mp~a>76EZSm>{`{Ofspnyad?hD&eL?7zL!*VQ!8z^mEc{V#~hj}ZU> literal 0 HcmV?d00001 diff --git a/Demo/HudDemo.xcodeproj/project.pbxproj b/Demo/HudDemo.xcodeproj/project.pbxproj index ba55088..bfb8e91 100755 --- a/Demo/HudDemo.xcodeproj/project.pbxproj +++ b/Demo/HudDemo.xcodeproj/project.pbxproj @@ -16,6 +16,9 @@ 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 */; }; + 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 */; }; /* End PBXBuildFile section */ @@ -35,7 +38,10 @@ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 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 = ""; }; - D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "37x-Checkmark.png"; path = "../Images/37x-Checkmark.png"; sourceTree = ""; }; + D277FDB211FC834200304321 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; + D277FDB711FC877E00304321 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + D277FDB811FC877E00304321 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = ""; }; + D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "37x-Checkmark.png"; path = "Images/37x-Checkmark.png"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -61,7 +67,6 @@ 1D3623250D0F684500981E51 /* HudDemoAppDelegate.m */, 28D7ACF60DDB3853001CB0EB /* HudDemoViewController.h */, 28D7ACF70DDB3853001CB0EB /* HudDemoViewController.m */, - D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */, ); path = Classes; sourceTree = ""; @@ -98,8 +103,8 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - 2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */, - 28AD733E0D9D9553002E5188 /* MainWindow.xib */, + D277FDBF11FC880100304321 /* UI */, + D277FDBD11FC879500304321 /* Images */, 8D1107310486CEB800E47090 /* Info.plist */, ); name = Resources; @@ -115,6 +120,26 @@ name = Frameworks; sourceTree = ""; }; + D277FDBD11FC879500304321 /* Images */ = { + isa = PBXGroup; + children = ( + D277FDB711FC877E00304321 /* Icon.png */, + D277FDB811FC877E00304321 /* Icon@2x.png */, + D277FDB211FC834200304321 /* Default.png */, + D2F88CD5115E9F7F00E6DB82 /* 37x-Checkmark.png */, + ); + name = Images; + sourceTree = ""; + }; + D277FDBF11FC880100304321 /* UI */ = { + isa = PBXGroup; + children = ( + 2899E5210DE3E06400AC0155 /* HudDemoViewController.xib */, + 28AD733E0D9D9553002E5188 /* MainWindow.xib */, + ); + name = UI; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -160,6 +185,9 @@ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 2899E5220DE3E06400AC0155 /* HudDemoViewController.xib in Resources */, D2F88CD6115E9F7F00E6DB82 /* 37x-Checkmark.png in Resources */, + D277FDB311FC834200304321 /* Default.png in Resources */, + D277FDB911FC877E00304321 /* Icon.png in Resources */, + D277FDBA11FC877E00304321 /* Icon@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Demo/HudDemoViewController.xib b/Demo/HudDemoViewController.xib index 53b2d29..9d24939 100644 --- a/Demo/HudDemoViewController.xib +++ b/Demo/HudDemoViewController.xib @@ -2,17 +2,17 @@ 528 - 10C540 - 740 - 1038.25 - 458.00 + 10F569 + 788 + 1038.29 + 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 62 + 117 YES - + YES @@ -31,164 +31,197 @@ YES IBFilesOwner + IBCocoaTouchFramework IBFirstResponder + IBCocoaTouchFramework - + 274 YES - - - 294 - {{20, 20}, {280, 40}} - - NO + + + 290 + + YES + + + 294 + {{20, 20}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + Helvetica-Bold + 15 + 16 + + 1 + Simple indeterminate progress + + 1 + MSAxIDEAA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MAA + + + + + 294 + {{20, 68}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + 1 + With label + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 294 + {{20, 116}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + 1 + With details label + With details label + With details label + With details label + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 294 + {{20, 164}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + 1 + Determinate mode + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 294 + {{20, 260}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + 1 + Mode switching + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 294 + {{20, 308}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + 1 + GCD and blocks + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 294 + {{20, 212}, {280, 40}} + + NO + NO + IBCocoaTouchFramework + 0 + 3 + + 1 + Custom view + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + {320, 368} + + + 1 + MC44ODYyNzQ1MDk4IDAuOTA1ODgyMzUyOSAwLjkyOTQxMTc2NDcAA + NO - 0 - 3 - - Helvetica-Bold - 15 - 16 - - 1 - Simple indeterminate progress - - 1 - MSAxIDEAA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MAA - - - - - 294 - {{20, 68}, {280, 40}} - - NO - NO - 0 - 3 - - 1 - With label - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 294 - {{20, 116}, {280, 40}} - - NO - NO - 0 - 3 - - 1 - With details label - With details label - With details label - With details label - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 294 - {{20, 164}, {280, 40}} - - NO - NO - 0 - 3 - - 1 - Determinate mode - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 294 - {{20, 260}, {280, 40}} - - NO - NO - 0 - 3 - - 1 - Mode switching - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 294 - {{20, 212}, {280, 40}} - - NO - NO - 0 - 3 - - 1 - Custom view - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - + + IBCocoaTouchFramework {320, 460} - - 1 - MC44ODYyNzQ1MDk4IDAuOTA1ODgyMzUyOSAwLjkyOTQxMTc2NDcAA - - NO - + YES + YES + IBCocoaTouchFramework YES - - - view - - - - 7 - showSimple: @@ -243,6 +276,23 @@ 47 + + + showUsingBlocks: + + + 7 + + 51 + + + + view + + + + 70 + @@ -265,48 +315,63 @@ - 6 - + 52 + + + YES + + + + + + 54 + YES - + + - - - - 20 - - - - - 16 - - - - - 10 - - - - - 9 - - + 8 - + + + + 9 + + + + + 10 + + + + + 16 + + + + + 20 + + + + + 49 + + 43 - + @@ -320,8 +385,11 @@ 16.IBPluginDependency 20.IBPluginDependency 43.IBPluginDependency - 6.IBEditorWindowLastContentRect - 6.IBPluginDependency + 49.IBPluginDependency + 52.IBEditorWindowLastContentRect + 52.IBPluginDependency + 54.IBEditorWindowLastContentRect + 54.IBPluginDependency 8.IBPluginDependency 9.IBPluginDependency @@ -333,7 +401,10 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{179, 181}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{245, 110}, {320, 460}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{217, 96}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -355,7 +426,7 @@ - 48 + 70 @@ -368,12 +439,12 @@ YES showSimple: + showUsingBlocks: showWithCustomView: showWithDetailsLabel: showWithLabel: showWithLabelDeterminate: showWithLabelMixed: - showWithLabelOnly: YES @@ -386,21 +457,256 @@ id + + YES + + YES + showSimple: + showUsingBlocks: + showWithCustomView: + showWithDetailsLabel: + showWithLabel: + showWithLabelDeterminate: + showWithLabelMixed: + + + YES + + showSimple: + id + + + showUsingBlocks: + id + + + showWithCustomView: + id + + + showWithDetailsLabel: + id + + + showWithLabel: + id + + + showWithLabelDeterminate: + id + + + showWithLabelMixed: + id + + + IBProjectSource Classes/HudDemoViewController.h + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + 0 + IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 @@ -409,6 +715,6 @@ YES HudDemo.xcodeproj 3 - 3.1 + 117 diff --git a/Demo/Icon.png b/Demo/Icon.png new file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yw` zXZd1DEFm+Kr2gza6*6QxHI*TWeo}{)BB7LQRyS}(H<{Q)(Gz%(pGH2^-88%z79iq2l5UpS$gR~brzx29cjgx zn)ypwTKds}Z5q?X5CG@(O}>J#rrXtzCc!SGHq1Nu+I|W7CV3F(fo_w-LpYKDc2dFd z-6jb!G2J>VE@sx-GL9dwoph$i7Z8o^oLCZGWqlcyC<=^h>`tC88&aSgxkI$qf@01kfk(o>mFB*ALS0jg2 z%Z!fu_07yugLP5}gsJV1Q>0^Zks6X=O^h8_{El1y^qAyFzCL!vm>|f91LPvDqN0LG zBno}A1szjOJPG=$eN0*;k;3mVdeMt8;rdo~ZiJjkm?JmiCm*Y0Sf;ZFEPGcz+26BAR@+ct8f>TB2T{GXGL g-)|MybtoACvKGDi89fdZrzf5!h8C~}eb@MZ0NZTwF#rGn literal 0 HcmV?d00001 diff --git a/Demo/Info.plist b/Demo/Info.plist index fdf8340..cd4302b 100644 --- a/Demo/Info.plist +++ b/Demo/Info.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:identifier} + com.bukovinski.${PRODUCT_NAME:identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Demo/MainWindow.xib b/Demo/MainWindow.xib index b72ae0d..e8a8990 100644 --- a/Demo/MainWindow.xib +++ b/Demo/MainWindow.xib @@ -1,31 +1,43 @@ - + 528 - 9E17 - 672 - 949.33 - 352.00 + 10F569 + 788 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 117 + YES - YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + YES + + YES + + + YES + + YES IBFilesOwner + IBCocoaTouchFramework IBFirstResponder + IBCocoaTouchFramework - - - HudDemoViewController - + + IBCocoaTouchFramework @@ -33,11 +45,46 @@ {320, 480} 1 - MSAxIDEAA + MC44ODYyNzQ1MDk4IDAuOTA1ODgyMzUyOSAwLjkyOTQxMTc2NDcAA NO NO + IBCocoaTouchFramework + + + + + 1 + + IBCocoaTouchFramework + NO + + + 256 + {0, 0} + NO + YES + YES + IBCocoaTouchFramework + + + YES + + MBProgressHUD + + MBProgressHUD + IBCocoaTouchFramework + + + HudDemoViewController + + 1 + + IBCocoaTouchFramework + NO + + @@ -51,14 +98,6 @@ 4 - - - viewController - - - - 11 - window @@ -67,58 +106,91 @@ 14 + + + navController + + + + 19 + YES 0 - - YES - + -1 - - RmlsZSdzIE93bmVyA + + File's Owner 3 - + HudDemo App Delegate -2 - - - - 10 - - + 12 - + + + + 15 + + + YES + + + + + + + 16 + + + YES + + + + + + 17 + + + + + 18 + + YES - + YES -1.CustomClassName -2.CustomClassName - 10.CustomClassName - 10.IBEditorWindowLastContentRect - 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency + 15.IBEditorWindowLastContentRect + 15.IBPluginDependency + 16.CustomClassName + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency 3.CustomClassName 3.IBPluginDependency @@ -126,20 +198,21 @@ YES UIApplication UIResponder - HudDemoViewController - {{512, 351}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{150, 451}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + HudDemoViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin HudDemoAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES - - YES - + YES @@ -147,15 +220,13 @@ YES - - YES - + YES - 14 + 19 @@ -165,17 +236,36 @@ NSObject YES - + YES - viewController + navController window YES - HudDemoViewController + UINavigationController UIWindow + + YES + + YES + navController + window + + + YES + + navController + UINavigationController + + + window + UIWindow + + + IBProjectSource Classes/HudDemoAppDelegate.h @@ -192,15 +282,313 @@ HudDemoViewController UIViewController + + YES + + YES + showSimple: + showUsingBlocks: + showWithCustomView: + showWithDetailsLabel: + showWithLabel: + showWithLabelDeterminate: + showWithLabelMixed: + + + YES + id + id + id + id + id + id + id + + + + YES + + YES + showSimple: + showUsingBlocks: + showWithCustomView: + showWithDetailsLabel: + showWithLabel: + showWithLabelDeterminate: + showWithLabelMixed: + + + YES + + showSimple: + id + + + showUsingBlocks: + id + + + showWithCustomView: + id + + + showWithDetailsLabel: + id + + + showWithLabel: + id + + + showWithLabelDeterminate: + id + + + showWithLabelMixed: + id + + + IBProjectSource Classes/HudDemoViewController.h + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIApplication + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIApplication.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UINavigationBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UINavigationBar.h + + + + UINavigationController + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UINavigationItem + NSObject + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + UIWindow + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIWindow.h + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES HudDemo.xcodeproj 3 + 117 diff --git a/MBProgressHUD.h b/MBProgressHUD.h index b5dba35..722444c 100644 --- a/MBProgressHUD.h +++ b/MBProgressHUD.h @@ -131,10 +131,35 @@ typedef enum { UIFont *detailsLabelFont; BOOL isFinished; + BOOL removeFromSuperViewOnHide; UIView *customView; } +/** + * Creates a new hud, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:. + * + * @param view The view that the HUD will be added to + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. + * @return A reference to the created HUD. + * + * @see hideHUDForView:animated: + */ ++ (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated; + +/** + * Finds a HUD sibview and hides it. The counterpart to this method is showHUDAddedTo:animated:. + * + * @param view The view that is going to be searched for a HUD subview. + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. + * @return YES if a HUD was found and removed, NO otherwise. + * + * @see hideHUDForView:animated: + */ ++ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated; + /** * A convenience constructor that initializes the HUD with the window's bounds. Calls the designated constructor with * window.bounds as the parameter. @@ -238,6 +263,12 @@ typedef enum { */ @property (assign) BOOL taskInProgress; +/** + * Removes the HUD from it's parent view when hidden. + * Defaults to NO. + */ +@property (assign) BOOL removeFromSuperViewOnHide; + /** * Font to be used for the main label. Set this property if the default is not adequate. */ @@ -258,8 +289,8 @@ typedef enum { * the user interface can be updated. Call this method when your task is already set-up to be executed in a new thread * (e.g., when using something like NSOperation or calling an asynchronous call like NSUrlRequest). * - * @param animated If set to YES the HUD will appear using a fade animation. If set to NO the HUD will not use - * animations while appearing. + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. */ - (void)show:(BOOL)animated; @@ -267,7 +298,7 @@ typedef enum { * Hide the HUD, this still calls the hudWasHidden delegate. This is the counterpart of the hide: method. Use it to * hide the HUD when your task completes. * - * @param animated If set to YES the HUD will disappear using a fade animation. If set to NO the HUD will not use + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use * animations while disappearing. */ - (void)hide:(BOOL)animated; @@ -281,8 +312,8 @@ typedef enum { * @param method The method to be executed while the HUD is shown. This method will be executed in a new thread. * @param target The object that the target method belongs to. * @param object An optional object to be passed to the method. - * @param animated If set to YES the HUD will appear and disappear using a fade animation. If set to NO the HUD will - * not use animations while appearing and disappearing. + * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use + * animations while disappearing. */ - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated; diff --git a/MBProgressHUD.m b/MBProgressHUD.m index 793b260..ddb2392 100644 --- a/MBProgressHUD.m +++ b/MBProgressHUD.m @@ -53,6 +53,7 @@ @synthesize graceTimer; @synthesize minShowTimer; @synthesize taskInProgress; +@synthesize removeFromSuperViewOnHide; @synthesize customView; @@ -66,9 +67,15 @@ mode = newMode; - [self performSelectorOnMainThread:@selector(updateIndicators) withObject:nil waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsLayout) withObject:nil waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + if ([NSThread isMainThread]) { + [self updateIndicators]; + [self setNeedsLayout]; + [self setNeedsDisplay]; + } else { + [self performSelectorOnMainThread:@selector(updateIndicators) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsLayout) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + } } - (MBProgressHUDMode)mode { @@ -76,9 +83,15 @@ } - (void)setLabelText:(NSString *)newText { - [self performSelectorOnMainThread:@selector(updateLabelText:) withObject:newText waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsLayout) withObject:nil waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + if ([NSThread isMainThread]) { + [self updateLabelText:newText]; + [self setNeedsLayout]; + [self setNeedsDisplay]; + } else { + [self performSelectorOnMainThread:@selector(updateLabelText:) withObject:newText waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsLayout) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + } } - (NSString *)labelText { @@ -86,9 +99,15 @@ } - (void)setDetailsLabelText:(NSString *)newText { - [self performSelectorOnMainThread:@selector(updateDetailsLabelText:) withObject:newText waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsLayout) withObject:nil waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + if ([NSThread isMainThread]) { + [self updateDetailsLabelText:newText]; + [self setNeedsLayout]; + [self setNeedsDisplay]; + } else { + [self performSelectorOnMainThread:@selector(updateDetailsLabelText:) withObject:newText waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsLayout) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + } } - (NSString *)detailsLabelText { @@ -100,8 +119,13 @@ // Update display ony if showing the determinate progress view if (mode == MBProgressHUDModeDeterminate) { - [self performSelectorOnMainThread:@selector(updateProgress) withObject:nil waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + if ([NSThread isMainThread]) { + [self updateProgress]; + [self setNeedsDisplay]; + } else { + [self performSelectorOnMainThread:@selector(updateProgress) withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; + } } } @@ -161,6 +185,35 @@ #define PI 3.14159265358979323846 + +#pragma mark - +#pragma mark Class methods + ++ (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated { + MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:view]; + [view addSubview:hud]; + [hud show:animated]; + return [hud autorelease]; +} + ++ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated { + UIView *viewToRemove = nil; + for (UIView *v in [view subviews]) { + if ([v isKindOfClass:[MBProgressHUD class]]) { + viewToRemove = v; + } + } + if (viewToRemove != nil) { + MBProgressHUD *HUD = (MBProgressHUD *)viewToRemove; + HUD.removeFromSuperViewOnHide = YES; + [HUD hide:animated]; + return YES; + } else { + return NO; + } +} + + #pragma mark - #pragma mark Lifecycle methods @@ -191,6 +244,7 @@ self.yOffset = 0.0; self.graceTime = 0.0; self.minShowTime = 0.0; + self.removeFromSuperViewOnHide = NO; self.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; @@ -426,6 +480,10 @@ [delegate performSelector:@selector(hudWasHidden)]; } } + + if (removeFromSuperViewOnHide) { + [self removeFromSuperview]; + } } - (void)cleanUp {