From 6140d0c74f60d183c1f74119ddea657c3f440abd Mon Sep 17 00:00:00 2001 From: northwind Date: Tue, 19 Aug 2014 00:06:15 +0800 Subject: [PATCH 1/5] add another api to support the case : only have status --- Demo/Classes/ViewController.h | 1 + Demo/Classes/ViewController.m | 4 + Demo/ViewController.xib | 508 ++++++++++++++++++++++++++-------- SVStatusHUD/SVStatusHUD.h | 1 + SVStatusHUD/SVStatusHUD.m | 40 ++- 5 files changed, 432 insertions(+), 122 deletions(-) diff --git a/Demo/Classes/ViewController.h b/Demo/Classes/ViewController.h index d081bc3..3fecf92 100644 --- a/Demo/Classes/ViewController.h +++ b/Demo/Classes/ViewController.h @@ -12,6 +12,7 @@ - (IBAction)showWithImage; - (IBAction)showWithImageStatus; +- (IBAction)showWithStatusDuration:(id)sender; @end diff --git a/Demo/Classes/ViewController.m b/Demo/Classes/ViewController.m index acbc314..dcf1dda 100644 --- a/Demo/Classes/ViewController.m +++ b/Demo/Classes/ViewController.m @@ -27,4 +27,8 @@ - (void)showWithImageStatus { [SVStatusHUD showWithImage:[UIImage imageNamed:@"wifi"] status:@"Connected"]; } +- (IBAction)showWithStatusDuration:(id)sender { + [SVStatusHUD showWithStatus:@"Add another api to support case only have status." duration:2.0]; +} + @end diff --git a/Demo/ViewController.xib b/Demo/ViewController.xib index 274f97e..a8f1767 100644 --- a/Demo/ViewController.xib +++ b/Demo/ViewController.xib @@ -1,31 +1,28 @@ - + - 1280 - 11C74 - 1938 - 1138.23 - 567.00 + 2048 + 13E28 + 6205 + 1265.21 + 698.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 + 6198 - - YES + IBProxyObject - IBUIView IBUIButton - - - YES + IBUIView + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin - + PluginDependencyRecalculationVersion - - YES + IBFilesOwner IBCocoaTouchFramework @@ -37,29 +34,28 @@ 292 - - YES + 293 {{30, 141}, {260, 44}} - + NO IBCocoaTouchFramework 0 0 1 - showWithImage:status: + + 1 + MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA + 3 MQA - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - + showWithImage:status: 3 MC41AA @@ -88,17 +84,39 @@ 0 0 1 - showWithImage: + - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - + showWithImage: - + + + 292 + {{58, 208}, {205, 44}} + + + NO + IBCocoaTouchFramework + 0 + 0 + 1 + + + showWithStatus:duration: + + + 2 + 15 + + + HelveticaNeue-Bold + 15 + 16 + + + {320, 460} @@ -107,12 +125,15 @@ 2 MC45MDE5NjA4NDk4IDAuOTAxOTYwODQ5OCAwLjkwMTk2MDg0OTgAA + + IBUISimulatedFreeformSizeMetricsSentinel + Freeform + IBCocoaTouchFramework - + - - YES + view @@ -139,15 +160,21 @@ 28 - + + + showWithStatusDuration: + + + 7 + + 30 + + - - YES + 0 - - YES - + @@ -156,128 +183,383 @@ File's Owner + + + + + -2 + + + + + 8 - - YES + - + + + + + + + + + + + + 1 + {0, 0} + + + + + + + + 2 + {320, 460} + + + + + + + + + + + + + + + + + + + + + + + + ibDesignableContentView.ibShadowedSubviews + + + + + + + 9 + + + + + + + + + + + + + + 1 + {30, 72} + + + + + + + + 2 + {260, 44} + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + + + + 1 + {30, 141} + + + + + + + + 2 + {260, 44} + + + + + + + + + + + + + + + + + + + + + + + + - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 10.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - ViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - + + 29 + + + + + + + + + + + + + + + + 1 + {58, 208} + + + + + + + + 2 + {205, 44} + + + + + + + + + + + + + + + + + + + + + + + + + + + + ViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + - - YES - - - + - 28 + 30 - - YES + ViewController UIViewController - - YES - - YES - showWithImage - showWithImageStatus + + id + id + id + + + + showWithImage + id + + + showWithImageStatus + id - - YES - id - id + + showWithStatusDuration: + id + + + IBProjectSource + ../Classes/ViewController.h + + + + ViewController + + showWithStatusDuration: + id - YES - - YES - showWithImage - showWithImageStatus - - - YES - - showWithImage - id - - - showWithImageStatus - id - + showWithStatusDuration: + + showWithStatusDuration: + id IBProjectSource - ./Classes/ViewController.h + ../Classes/ViewController.m - + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIGestureRecognizer + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIGestureRecognizer.h + + + + UIResponder + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + 0 IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - + NO com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - + YES 3 - 933 diff --git a/SVStatusHUD/SVStatusHUD.h b/SVStatusHUD/SVStatusHUD.h index dcdbb88..e657b99 100644 --- a/SVStatusHUD/SVStatusHUD.h +++ b/SVStatusHUD/SVStatusHUD.h @@ -13,6 +13,7 @@ + (void)showWithImage:(UIImage*)image; + (void)showWithImage:(UIImage*)image status:(NSString*)string; ++ (void)showWithStatus:(NSString*)string duration:(NSTimeInterval)duration; + (void)showWithImage:(UIImage*)image status:(NSString*)string duration:(NSTimeInterval)duration; @end diff --git a/SVStatusHUD/SVStatusHUD.m b/SVStatusHUD/SVStatusHUD.m index f000c2c..762890b 100644 --- a/SVStatusHUD/SVStatusHUD.m +++ b/SVStatusHUD/SVStatusHUD.m @@ -81,6 +81,11 @@ + (void)showWithImage:(UIImage*)image status:(NSString*)string { [SVStatusHUD showWithImage:image status:string duration:SVStatusHUDVisibleDuration]; } ++ (void)showWithStatus:(NSString*)string duration:(NSTimeInterval)duration +{ + [SVStatusHUD showWithImage:nil status:string duration:duration]; +} + + (void)showWithImage:(UIImage*)image status:(NSString*)string duration:(NSTimeInterval)duration { [[SVStatusHUD sharedView] showWithImage:image status:string duration:duration]; } @@ -106,22 +111,39 @@ - (void)setStatus:(NSString *)string { CGFloat hudWidth = 160; CGFloat hudHeight = 160; - + self.hudView.bounds = CGRectMake(0, 0, hudWidth, hudHeight); - if(!string) - self.imageView.center = CGPointMake(self.hudView.bounds.size.width/2, self.hudView.bounds.size.height/2); - else - self.imageView.center = CGPointMake(self.hudView.bounds.size.width/2, 70); - - self.stringLabel.hidden = NO; - self.stringLabel.text = string; + self.stringLabel.hidden = NO; + self.stringLabel.text = string; + + if( string == nil ){ + if ( imageView != nil ){ + self.imageView.center = CGPointMake(hudWidth/2, hudHeight/2); + } + }else{ + if ( imageView == nil ){ + stringLabel.frame = CGRectMake(10, 0, hudWidth-10, hudHeight); + }else{ + self.imageView.center = CGPointMake(hudWidth/2, 70); + stringLabel.frame = CGRectMake(0, 123, 160, 20); + } + } + } - (void)showWithImage:(UIImage *)image status:(NSString *)string duration:(NSTimeInterval)duration { - self.imageView.image = image; + if ( image == nil ){ + if ( imageView != nil ){ + [imageView removeFromSuperview]; + [imageView release]; + imageView = nil; + } + }else{ + self.imageView.image = image; + } [self setStatus:string]; [self.overlayWindow setHidden:NO]; From 7321070935f620963d30ce428fd1fea483dabf43 Mon Sep 17 00:00:00 2001 From: northwind Date: Tue, 19 Aug 2014 00:19:19 +0800 Subject: [PATCH 2/5] add pod spec --- SVStatusHUD2.podspec | 131 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 SVStatusHUD2.podspec diff --git a/SVStatusHUD2.podspec b/SVStatusHUD2.podspec new file mode 100644 index 0000000..4206be9 --- /dev/null +++ b/SVStatusHUD2.podspec @@ -0,0 +1,131 @@ +# +# Be sure to run `pod spec lint SVStatusHUD2.podspec' to ensure this is a +# valid spec and to remove all comments including this before submitting the spec. +# +# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +Pod::Spec.new do |s| + + # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # These will help people to find your library, and whilst it + # can feel like a chore to fill in it's definitely to your advantage. The + # summary should be tweet-length, and the description more in depth. + # + + s.name = "SVStatusHUD2" + s.version = "0.1" + s.summary = "SVStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS." + + s.description = <<-DESC + SVStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS. It should only be used in response to hardware or other important notifications (for instance when an accessory is detected by your app). If you’re just looking to show the progress or success of an operation, you should have a look at SVProgressHUD. + DESC + + s.homepage = "https://github.com/northwind/SVStatusHUD" + # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" + + + # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Licensing your code is important. See http://choosealicense.com for more info. + # CocoaPods will detect a license file if there is a named LICENSE* + # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. + # + + s.license = "MIT" + # s.license = { :type => "MIT", :file => "FILE_LICENSE" } + + + # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Specify the authors of the library, with email addresses. Email addresses + # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also + # accepts just a name if you'd rather not provide an email address. + # + # Specify a social_media_url where others can refer to, for example a twitter + # profile URL. + # + + s.author = { "northwind" => "norristong_x@qq.com" } + # Or just: s.author = "northwind" + # s.authors = { "northwind" => "norristong_x@qq.com" } + # s.social_media_url = "http://twitter.com/northwind" + + # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # If this Pod runs only on iOS or OS X, then specify the platform and + # the deployment target. You can optionally include the target after the platform. + # + + # s.platform = :ios + # s.platform = :ios, "5.0" + + # When using multiple platforms + # s.ios.deployment_target = "5.0" + # s.osx.deployment_target = "10.7" + + + # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Specify the location from where the source should be retrieved. + # Supports git, hg, bzr, svn and HTTP. + # + + s.source = { :git => "https://github.com/northwind/SVStatusHUD", :tag => "0.1" } + + + # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # CocoaPods is smart about how it includes source code. For source files + # giving a folder will include any h, m, mm, c & cpp files. For header + # files it will include any header in the folder. + # Not including the public_header_files will make all headers public. + # + + s.source_files = "SVStatusHUD/*.{h,m}" + # s.exclude_files = "Classes/Exclude" + + # s.public_header_files = "Classes/**/*.h" + + + # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # A list of resources included with the Pod. These are copied into the + # target bundle with a build phase script. Anything else will be cleaned. + # You can preserve files from being cleaned, please don't preserve + # non-essential files like tests, examples and documentation. + # + + # s.resource = "icon.png" + # s.resources = "Resources/*.png" + + # s.preserve_paths = "FilesToSave", "MoreFilesToSave" + + + # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Link your library with frameworks, or libraries. Libraries do not include + # the lib prefix of their name. + # + + # s.framework = "SomeFramework" + # s.frameworks = "SomeFramework", "AnotherFramework" + + # s.library = "iconv" + # s.libraries = "iconv", "xml2" + + + # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # If your library depends on compiler flags you can set them in the xcconfig hash + # where they will only apply to your library. If you depend on other Podspecs + # you can include multiple dependencies to ensure it works. + + s.requires_arc = false + + # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } + # s.dependency "JSONKit", "~> 1.4" + +end From 4ed9be2be31c2fec3b22ea8377dd336aae0f780d Mon Sep 17 00:00:00 2001 From: northwind Date: Tue, 19 Aug 2014 00:28:01 +0800 Subject: [PATCH 3/5] update podspec --- SVStatusHUD2.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SVStatusHUD2.podspec b/SVStatusHUD2.podspec index 4206be9..9f2bd9b 100644 --- a/SVStatusHUD2.podspec +++ b/SVStatusHUD2.podspec @@ -59,7 +59,7 @@ Pod::Spec.new do |s| # the deployment target. You can optionally include the target after the platform. # - # s.platform = :ios + s.platform = :ios # s.platform = :ios, "5.0" # When using multiple platforms @@ -73,7 +73,7 @@ Pod::Spec.new do |s| # Supports git, hg, bzr, svn and HTTP. # - s.source = { :git => "https://github.com/northwind/SVStatusHUD", :tag => "0.1" } + s.source = { :git => "https://github.com/northwind/SVStatusHUD.git", :tag => s.version.to_s } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # @@ -110,7 +110,7 @@ Pod::Spec.new do |s| # the lib prefix of their name. # - # s.framework = "SomeFramework" + s.framework = "UIKit" # s.frameworks = "SomeFramework", "AnotherFramework" # s.library = "iconv" From 06d1e5ed3c158b3b8a51967d50f918fddfa9acdc Mon Sep 17 00:00:00 2001 From: northwind Date: Tue, 19 Aug 2014 00:28:15 +0800 Subject: [PATCH 4/5] update podspec --- SVStatusHUD2.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVStatusHUD2.podspec b/SVStatusHUD2.podspec index 9f2bd9b..4170622 100644 --- a/SVStatusHUD2.podspec +++ b/SVStatusHUD2.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "SVStatusHUD2" - s.version = "0.1" + s.version = "0.1.1" s.summary = "SVStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS." s.description = <<-DESC From 3c52bcea39ce840206874a68595dab2d1674ae0c Mon Sep 17 00:00:00 2001 From: northwind Date: Tue, 19 Aug 2014 00:33:49 +0800 Subject: [PATCH 5/5] change pod name --- SVStatusHUD2.podspec => TYStatusHUD.podspec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename SVStatusHUD2.podspec => TYStatusHUD.podspec (94%) diff --git a/SVStatusHUD2.podspec b/TYStatusHUD.podspec similarity index 94% rename from SVStatusHUD2.podspec rename to TYStatusHUD.podspec index 4170622..2a020ef 100644 --- a/SVStatusHUD2.podspec +++ b/TYStatusHUD.podspec @@ -15,12 +15,13 @@ Pod::Spec.new do |s| # summary should be tweet-length, and the description more in depth. # - s.name = "SVStatusHUD2" - s.version = "0.1.1" - s.summary = "SVStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS." + s.name = "TYStatusHUD" + s.version = "0.2" + s.summary = "TYStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS." s.description = <<-DESC - SVStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS. It should only be used in response to hardware or other important notifications (for instance when an accessory is detected by your app). If you’re just looking to show the progress or success of an operation, you should have a look at SVProgressHUD. + TYStatusHUD mimics the HUD shown on orientation lock, mute and volume change on iOS. It should only be used in response to hardware or other important notifications (for instance when an accessory is detected by your app). + forked from SVStatusHUD DESC s.homepage = "https://github.com/northwind/SVStatusHUD"