From 4f007cde2033da26ec5ad31e1866c887aa91368a Mon Sep 17 00:00:00 2001 From: Jonas Gessner Date: Wed, 7 Jan 2015 13:18:00 +0100 Subject: [PATCH] 1.2.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Removed asserts. • Some fixes for Swift. • Removed JGProgressStyleNone (See #18 to know why). • Made base SDK >= iOS 8 obligatory. --- JGProgressHUD.podspec | 4 +- JGProgressHUD/JGProgressHUD/JGProgressHUD.h | 20 ++- JGProgressHUD/JGProgressHUD/JGProgressHUD.m | 127 +++++++++--------- .../JGProgressHUD/JGProgressHUDAnimation.h | 5 +- .../JGProgressHUD/JGProgressHUDAnimation.m | 1 + .../JGProgressHUDFadeAnimation.m | 1 + .../JGProgressHUDFadeZoomAnimation.m | 1 + README.md | 4 +- 8 files changed, 92 insertions(+), 71 deletions(-) diff --git a/JGProgressHUD.podspec b/JGProgressHUD.podspec index 48aeeb7..c271b3e 100644 --- a/JGProgressHUD.podspec +++ b/JGProgressHUD.podspec @@ -1,14 +1,14 @@ Pod::Spec.new do |s| s.name = "JGProgressHUD" - s.version = "1.2.2" + s.version = "1.2.3" s.summary = "Powerful and modern progress HUD for iOS." s.homepage = "https://github.com/JonasGessner/JGProgressHUD" s.license = { :type => "MIT", :file => "LICENSE.txt" } s.author = "Jonas Gessner" s.social_media_url = "http://twitter.com/JonasGessner" s.platform = :ios, "5.0" - s.source = { :git => "https://github.com/JonasGessner/JGProgressHUD.git", :tag => "v1.2.2" } + s.source = { :git => "https://github.com/JonasGessner/JGProgressHUD.git", :tag => "v1.2.3" } s.source_files = "JGProgressHUD/JGProgressHUD/*.{h,m}" s.resources = "JGProgressHUD/JGProgressHUD/JGProgressHUD Resources.bundle" s.frameworks = "Foundation", "UIKit", "QuartzCore" diff --git a/JGProgressHUD/JGProgressHUD/JGProgressHUD.h b/JGProgressHUD/JGProgressHUD/JGProgressHUD.h index 17ddd46..2338c0a 100755 --- a/JGProgressHUD/JGProgressHUD/JGProgressHUD.h +++ b/JGProgressHUD/JGProgressHUD/JGProgressHUD.h @@ -10,20 +10,29 @@ #import #import "JGProgressHUDIndicatorView.h" -@class JGProgressHUDAnimation; +#import "JGProgressHUDAnimation.h" /** Positions of the HUD. */ typedef NS_ENUM(NSUInteger, JGProgressHUDPosition) { + /** Center position. */ JGProgressHUDPositionCenter = 0, + /** Top left position. */ JGProgressHUDPositionTopLeft, + /** Top center position. */ JGProgressHUDPositionTopCenter, + /** Top right position. */ JGProgressHUDPositionTopRight, + /** Center left position. */ JGProgressHUDPositionCenterLeft, + /** Center right position. */ JGProgressHUDPositionCenterRight, + /** Bottom left position. */ JGProgressHUDPositionBottomLeft, + /** Bottom center position. */ JGProgressHUDPositionBottomCenter, + /** Bottom right position. */ JGProgressHUDPositionBottomRight }; @@ -31,18 +40,23 @@ typedef NS_ENUM(NSUInteger, JGProgressHUDPosition) { Appearance styles of the HUD. */ typedef NS_ENUM(NSUInteger, JGProgressHUDStyle) { + /** Extra light HUD with dark elements. */ JGProgressHUDStyleExtraLight = 0, + /** Light HUD with dark elemets. */ JGProgressHUDStyleLight, - JGProgressHUDStyleDark, - JGProgressHUDStyleNone + /** Dark HUD with light elements. */ + JGProgressHUDStyleDark }; /** Interaction types. */ typedef NS_ENUM(NSUInteger, JGProgressHUDInteractionType) { + /** Block all touches. No interaction behin the HUD is possible. */ JGProgressHUDInteractionTypeBlockAllTouches = 0, + /** Block touches on the HUD view. */ JGProgressHUDInteractionTypeBlockTouchesOnHUDView, + /** Block no touches. */ JGProgressHUDInteractionTypeBlockNoTouches }; diff --git a/JGProgressHUD/JGProgressHUD/JGProgressHUD.m b/JGProgressHUD/JGProgressHUD/JGProgressHUD.m index f543300..1dee300 100755 --- a/JGProgressHUD/JGProgressHUD/JGProgressHUD.m +++ b/JGProgressHUD/JGProgressHUD/JGProgressHUD.m @@ -15,36 +15,25 @@ #error "JGProgressHUD requires ARC!" #endif -#ifndef __IPHONE_8_0 -#define __IPHONE_8_0 80000 +#ifndef iPad +#define iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) #endif -#define kBaseSDKiOS8 (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0) - -#if kBaseSDKiOS8 -#define iOS8ex(available, unavailable) \ -if (iOS8) { \ -available \ -} \ -else { \ -unavailable \ -} -#else -#define iOS8ex(available, unavailable) \ -unavailable +#ifndef NSFoundationVersionNumber_iOS_7_0 +#define NSFoundationVersionNumber_iOS_7_0 1047.20 #endif -#ifndef iPad -#define iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) +#ifndef NSFoundationVersionNumber_iOS_8_0 +#define NSFoundationVersionNumber_iOS_8_0 1134.10 #endif -#ifndef kCFCoreFoundationVersionNumber_iOS_7_0 -#define kCFCoreFoundationVersionNumber_iOS_7_0 838.00 +#ifndef iOS7 +#define iOS7 (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0) #endif -#define iOS7 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) - -#define iOS8 ([UIVisualEffectView class] != Nil) +#ifndef iOS8 +#define iOS8 (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_8_0) +#endif @interface JGProgressHUD () { BOOL _transitioning; @@ -326,11 +315,11 @@ - (CGRect)fullFrameInView:(UIView *)view { - (void)applyCornerRadius { self.HUDView.layer.cornerRadius = self.cornerRadius; - iOS8ex( - for (UIView *sub in self.HUDView.subviews) { - sub.layer.cornerRadius = self.cornerRadius; - } - ,); + if (iOS8) { + for (UIView *sub in self.HUDView.subviews) { + sub.layer.cornerRadius = self.cornerRadius; + } + }; } #pragma mark - Showing @@ -381,8 +370,15 @@ - (void)showInRect:(CGRect)rect inView:(UIView *)view { } - (void)showInRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated { - NSAssert(!_transitioning, @"HUD is currently transitioning"); - NSAssert(!self.targetView, @"HUD is already visible"); + if (_transitioning) { + return; + } + else if (self.targetView != nil) { +#if DEBUG + NSLog(@"[Warning] The HUD is already visible! Ignoring."); +#endif + return; + } _targetView = view; @@ -435,7 +431,9 @@ - (void)dismissAnimated:(BOOL)animated { return; } - NSAssert(self.targetView, @"HUD is not visible"); + if (self.targetView == nil) { + return; + } _transitioning = YES; @@ -529,38 +527,36 @@ - (BOOL)isVisible { - (UIView *)HUDView { if (!_HUDView) { - iOS8ex( - UIBlurEffectStyle effect; - - if (self.style == JGProgressHUDStyleDark) { - effect = UIBlurEffectStyleDark; - } - else if (self.style == JGProgressHUDStyleLight) { - effect = UIBlurEffectStyleLight; - } - else { - effect = UIBlurEffectStyleExtraLight; - } - - UIBlurEffect *blurEffect = self.style != JGProgressHUDStyleNone ? [UIBlurEffect effectWithStyle:effect] : nil; - - _HUDView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; - , - _HUDView = [[UIView alloc] init]; - - if (self.style == JGProgressHUDStyleDark) { - _HUDView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.8f]; - } - else if (self.style == JGProgressHUDStyleLight) { - _HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.75f]; - } - else if (self.style == JGProgressHUDStyleNone) { - _HUDView.backgroundColor = [UIColor clearColor]; - } - else { - _HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.95f]; - } - ); + if (iOS8) { + UIBlurEffectStyle effect = 0; + + if (self.style == JGProgressHUDStyleDark) { + effect = UIBlurEffectStyleDark; + } + else if (self.style == JGProgressHUDStyleLight) { + effect = UIBlurEffectStyleLight; + } + else { + effect = UIBlurEffectStyleExtraLight; + } + + UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:effect]; + + _HUDView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; + } + else { + _HUDView = [[UIView alloc] init]; + + if (self.style == JGProgressHUDStyleDark) { + _HUDView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.8f]; + } + else if (self.style == JGProgressHUDStyleLight) { + _HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.75f]; + } + else { + _HUDView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.95f]; + } + } if (iOS7) { UIInterpolatingMotionEffect *x = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; @@ -593,7 +589,12 @@ - (UIView *)HUDView { } - (UIView *)contentView { - iOS8ex(return ((UIVisualEffectView *)self.HUDView).contentView;, return self.HUDView;); + if (iOS8) { + return ((UIVisualEffectView *)self.HUDView).contentView; + } + else { + return self.HUDView; + } } - (UILabel *)textLabel { diff --git a/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.h b/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.h index 738a74b..94e273f 100755 --- a/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.h +++ b/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.h @@ -6,7 +6,10 @@ // Copyright (c) 2014 Jonas Gessner. All rights reserved. // -#import "JGProgressHUD.h" +#import +#import + +@class JGProgressHUD; /** You may subclass this class to create a custom progress indicator view. diff --git a/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.m b/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.m index a80fa34..fb2628f 100755 --- a/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.m +++ b/JGProgressHUD/JGProgressHUD/JGProgressHUDAnimation.m @@ -7,6 +7,7 @@ // #import "JGProgressHUDAnimation.h" +#import "JGProgressHUD.h" @interface JGProgressHUD (Private) diff --git a/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeAnimation.m b/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeAnimation.m index e778867..b1f4119 100755 --- a/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeAnimation.m +++ b/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeAnimation.m @@ -7,6 +7,7 @@ // #import "JGProgressHUDFadeAnimation.h" +#import "JGProgressHUD.h" @implementation JGProgressHUDFadeAnimation diff --git a/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeZoomAnimation.m b/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeZoomAnimation.m index 73cca40..a2da64b 100755 --- a/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeZoomAnimation.m +++ b/JGProgressHUD/JGProgressHUD/JGProgressHUDFadeZoomAnimation.m @@ -7,6 +7,7 @@ // #import "JGProgressHUDFadeZoomAnimation.h" +#import "JGProgressHUD.h" @implementation JGProgressHUDFadeZoomAnimation diff --git a/README.md b/README.md index 805e3d0..be00413 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Overview
The JGProgressHUD Tests example project contains all kinds of different uses of JGProgressHUD. Check out the code and see how much JGProgressHUD can do!
-#####Current Version: 1.2.2 +#####Current Version: 1.2.3 ##Customization: @@ -52,7 +52,7 @@ To dim the content behind the HUD set your dim color as `backgroundColor` of you Requirements ================= -• Base SDK of iOS 7 or higher.
+• Base SDK of iOS 8 or higher.
• Deployment target of iOS 5 or higher.
• ARC.