From 942dca434b9ca0fcfa87c5561cadbfa7f04122ae Mon Sep 17 00:00:00 2001 From: Sam Vermette Date: Mon, 25 Apr 2011 15:12:17 -0400 Subject: [PATCH 1/3] Renamed resource bundle and images --- .../error.png} | Bin .../error@2x.png} | Bin .../success.png} | Bin .../success@2x.png} | Bin SVProgressHUD/SVProgressHUD.m | 4 ++-- Sample/SVProgressHUD.xcodeproj/project.pbxproj | 8 ++++---- 6 files changed, 6 insertions(+), 6 deletions(-) rename SVProgressHUD/{SVProgressHUDResources.bundle/svhud-error.png => SVProgressHUD.bundle/error.png} (100%) rename SVProgressHUD/{SVProgressHUDResources.bundle/svhud-error@2x.png => SVProgressHUD.bundle/error@2x.png} (100%) rename SVProgressHUD/{SVProgressHUDResources.bundle/svhud-success.png => SVProgressHUD.bundle/success.png} (100%) rename SVProgressHUD/{SVProgressHUDResources.bundle/svhud-success@2x.png => SVProgressHUD.bundle/success@2x.png} (100%) diff --git a/SVProgressHUD/SVProgressHUDResources.bundle/svhud-error.png b/SVProgressHUD/SVProgressHUD.bundle/error.png similarity index 100% rename from SVProgressHUD/SVProgressHUDResources.bundle/svhud-error.png rename to SVProgressHUD/SVProgressHUD.bundle/error.png diff --git a/SVProgressHUD/SVProgressHUDResources.bundle/svhud-error@2x.png b/SVProgressHUD/SVProgressHUD.bundle/error@2x.png similarity index 100% rename from SVProgressHUD/SVProgressHUDResources.bundle/svhud-error@2x.png rename to SVProgressHUD/SVProgressHUD.bundle/error@2x.png diff --git a/SVProgressHUD/SVProgressHUDResources.bundle/svhud-success.png b/SVProgressHUD/SVProgressHUD.bundle/success.png similarity index 100% rename from SVProgressHUD/SVProgressHUDResources.bundle/svhud-success.png rename to SVProgressHUD/SVProgressHUD.bundle/success.png diff --git a/SVProgressHUD/SVProgressHUDResources.bundle/svhud-success@2x.png b/SVProgressHUD/SVProgressHUD.bundle/success@2x.png similarity index 100% rename from SVProgressHUD/SVProgressHUDResources.bundle/svhud-success@2x.png rename to SVProgressHUD/SVProgressHUD.bundle/success@2x.png diff --git a/SVProgressHUD/SVProgressHUD.m b/SVProgressHUD/SVProgressHUD.m index f466d82a..4f446b85 100644 --- a/SVProgressHUD/SVProgressHUD.m +++ b/SVProgressHUD/SVProgressHUD.m @@ -206,9 +206,9 @@ - (void)dismissWithStatus:(NSString*)string error:(BOOL)error { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; if(error) - self.imageView.image = [UIImage imageNamed:@"svhud-error.png"]; + self.imageView.image = [UIImage imageNamed:@"SVProgressHUD.bundle/error.png"]; else - self.imageView.image = [UIImage imageNamed:@"svhud-success.png"]; + self.imageView.image = [UIImage imageNamed:@"SVProgressHUD.bundle/success.png"]; self.imageView.hidden = NO; diff --git a/Sample/SVProgressHUD.xcodeproj/project.pbxproj b/Sample/SVProgressHUD.xcodeproj/project.pbxproj index c5ed314a..b21e9341 100755 --- a/Sample/SVProgressHUD.xcodeproj/project.pbxproj +++ b/Sample/SVProgressHUD.xcodeproj/project.pbxproj @@ -12,13 +12,13 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 222A6821133FE36400DAE48C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 222A6820133FE36400DAE48C /* QuartzCore.framework */; }; + 22D13AB71365FEAC0025FCC9 /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 22D13AB61365FEAC0025FCC9 /* SVProgressHUD.bundle */; }; 22EBCD19134128130074B281 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22EBCD18134128130074B281 /* MainWindow-iPad.xib */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 2899E5220DE3E06400AC0155 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* ViewController.xib */; }; 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D7ACF80DDB3853001CB0EB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* ViewController.m */; }; 63ADC4BC1364C1360060E45B /* SVProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 63ADC4BA1364C1360060E45B /* SVProgressHUD.m */; }; - 63ADC4BD1364C1360060E45B /* SVProgressHUDResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63ADC4BB1364C1360060E45B /* SVProgressHUDResources.bundle */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -28,6 +28,7 @@ 1D6058910D05DD3D006BFB54 /* SVProgressHUD.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SVProgressHUD.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 222A6820133FE36400DAE48C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 22D13AB61365FEAC0025FCC9 /* SVProgressHUD.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SVProgressHUD.bundle; sourceTree = ""; }; 22EBCD18134128130074B281 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainWindow-iPad.xib"; path = "Resources-iPad/MainWindow-iPad.xib"; sourceTree = ""; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 2899E5210DE3E06400AC0155 /* ViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ViewController.xib; path = ../ViewController.xib; sourceTree = ""; }; @@ -38,7 +39,6 @@ 32CA4F630368D1EE00C91783 /* SVProgressHUD_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressHUD_Prefix.pch; sourceTree = ""; }; 63ADC4B91364C1360060E45B /* SVProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressHUD.h; sourceTree = ""; }; 63ADC4BA1364C1360060E45B /* SVProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVProgressHUD.m; sourceTree = ""; }; - 63ADC4BB1364C1360060E45B /* SVProgressHUDResources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SVProgressHUDResources.bundle; sourceTree = ""; }; 8D1107310486CEB800E47090 /* SVProgressHUD-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SVProgressHUD-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -133,7 +133,7 @@ children = ( 63ADC4B91364C1360060E45B /* SVProgressHUD.h */, 63ADC4BA1364C1360060E45B /* SVProgressHUD.m */, - 63ADC4BB1364C1360060E45B /* SVProgressHUDResources.bundle */, + 22D13AB61365FEAC0025FCC9 /* SVProgressHUD.bundle */, ); name = SVProgressHUD; path = ../../SVProgressHUD; @@ -191,7 +191,7 @@ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 2899E5220DE3E06400AC0155 /* ViewController.xib in Resources */, 22EBCD19134128130074B281 /* MainWindow-iPad.xib in Resources */, - 63ADC4BD1364C1360060E45B /* SVProgressHUDResources.bundle in Resources */, + 22D13AB71365FEAC0025FCC9 /* SVProgressHUD.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; From 373b619fccacf0f4336d0f0861f629387b4ebb51 Mon Sep 17 00:00:00 2001 From: Sam Vermette Date: Tue, 3 May 2011 21:08:03 -0400 Subject: [PATCH 2/3] Bug fix: calling show right after dismiss wasn't showing HUD as it should. --- SVProgressHUD/SVProgressHUD.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SVProgressHUD/SVProgressHUD.m b/SVProgressHUD/SVProgressHUD.m index 4f446b85..7e5a50f9 100644 --- a/SVProgressHUD/SVProgressHUD.m +++ b/SVProgressHUD/SVProgressHUD.m @@ -165,9 +165,12 @@ - (void)showInView:(UIView*)view status:(NSString*)string networkIndicator:(BOOL [spinnerView startAnimating]; if(![sharedView isDescendantOfView:view]) { - + sharedView.layer.opacity = 0; [view addSubview:sharedView]; + } + if(sharedView.layer.opacity != 1) { + posY+=(CGRectGetHeight(self.bounds)/2); self.center = CGPointMake(CGRectGetWidth(self.superview.bounds)/2, posY); @@ -197,7 +200,7 @@ - (void)dismiss { self.layer.transform = CATransform3DScale(CATransform3DMakeTranslation(0, 0, 0), 0.8, 0.8, 1.0); self.layer.opacity = 0; } - completion:^(BOOL finished){ [self removeFromSuperview]; }]; + completion:^(BOOL finished){ if(self.layer.opacity == 0) [self removeFromSuperview]; }]; } From f0f2e948d09c6df55be99210db1434604daafeb9 Mon Sep 17 00:00:00 2001 From: Sam Vermette Date: Mon, 16 May 2011 12:22:38 -0400 Subject: [PATCH 3/3] Bug fix: first time label is shown, width of HUD isn't right (thanks John Balestrieri) --- SVProgressHUD/SVProgressHUD.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVProgressHUD/SVProgressHUD.m b/SVProgressHUD/SVProgressHUD.m index 7e5a50f9..f7e2f2ef 100644 --- a/SVProgressHUD/SVProgressHUD.m +++ b/SVProgressHUD/SVProgressHUD.m @@ -129,7 +129,7 @@ - (id)initWithFrame:(CGRect)frame { - (void)setStatus:(NSString *)string { - CGFloat stringWidth = [string sizeWithFont:stringLabel.font].width+28; + CGFloat stringWidth = [string sizeWithFont:self.stringLabel.font].width+28; if(stringWidth < 100) stringWidth = 100;