From 40730aa170cca88160c2adbcbf157e002190bff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E4=BB=95=E5=B4=87?= Date: Sun, 26 Jul 2015 12:07:17 +0800 Subject: [PATCH] 1.0.4 --- Demo/WSProgressHUD.xcodeproj/project.pbxproj | 108 +++-- Demo/WSProgressHUD/WSProgressHUD.m | 6 +- Demo/WSProgressHUDDemo/ViewController.m | 7 +- WSProgressHUD.podspec | 99 +--- WSProgressHUD/FBShimmering-Prefix.pch | 9 - WSProgressHUD/FBShimmering.h | 67 --- WSProgressHUD/FBShimmeringLayer.h | 22 - WSProgressHUD/FBShimmeringLayer.m | 484 ------------------- WSProgressHUD/FBShimmeringView.h | 22 - WSProgressHUD/FBShimmeringView.m | 62 --- WSProgressHUD/WSProgressHUD.m | 6 +- 11 files changed, 76 insertions(+), 816 deletions(-) delete mode 100755 WSProgressHUD/FBShimmering-Prefix.pch delete mode 100755 WSProgressHUD/FBShimmering.h delete mode 100755 WSProgressHUD/FBShimmeringLayer.h delete mode 100755 WSProgressHUD/FBShimmeringLayer.m delete mode 100755 WSProgressHUD/FBShimmeringView.h delete mode 100755 WSProgressHUD/FBShimmeringView.m diff --git a/Demo/WSProgressHUD.xcodeproj/project.pbxproj b/Demo/WSProgressHUD.xcodeproj/project.pbxproj index 5cf1cee..49cf38a 100644 --- a/Demo/WSProgressHUD.xcodeproj/project.pbxproj +++ b/Demo/WSProgressHUD.xcodeproj/project.pbxproj @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - FE1C9C371B645F0700BB2D67 /* FBShimmeringLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = FE1C9C2D1B645F0700BB2D67 /* FBShimmeringLayer.m */; }; - FE1C9C381B645F0700BB2D67 /* FBShimmeringView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE1C9C2F1B645F0700BB2D67 /* FBShimmeringView.m */; }; - FE1C9C391B645F0700BB2D67 /* MMMaterialDesignSpinner.m in Sources */ = {isa = PBXBuildFile; fileRef = FE1C9C311B645F0700BB2D67 /* MMMaterialDesignSpinner.m */; }; - FE1C9C3A1B645F0700BB2D67 /* WSIndefiniteAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE1C9C331B645F0700BB2D67 /* WSIndefiniteAnimationView.m */; }; - FE1C9C3B1B645F0700BB2D67 /* WSProgressBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = FE1C9C341B645F0700BB2D67 /* WSProgressBundle.bundle */; }; - FE1C9C3C1B645F0700BB2D67 /* WSProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = FE1C9C361B645F0700BB2D67 /* WSProgressHUD.m */; }; + FE52FF251B648EDD00703FB5 /* FBShimmeringLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = FE52FF1B1B648EDD00703FB5 /* FBShimmeringLayer.m */; }; + FE52FF261B648EDD00703FB5 /* FBShimmeringView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE52FF1D1B648EDD00703FB5 /* FBShimmeringView.m */; }; + FE52FF271B648EDD00703FB5 /* MMMaterialDesignSpinner.m in Sources */ = {isa = PBXBuildFile; fileRef = FE52FF1F1B648EDD00703FB5 /* MMMaterialDesignSpinner.m */; }; + FE52FF281B648EDD00703FB5 /* WSIndefiniteAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE52FF211B648EDD00703FB5 /* WSIndefiniteAnimationView.m */; }; + FE52FF291B648EDD00703FB5 /* WSProgressBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = FE52FF221B648EDD00703FB5 /* WSProgressBundle.bundle */; }; + FE52FF2A1B648EDD00703FB5 /* WSProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = FE52FF241B648EDD00703FB5 /* WSProgressHUD.m */; }; FED429031B63E262002A5294 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FED428F21B63E262002A5294 /* AppDelegate.m */; }; FED429061B63E262002A5294 /* image1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = FED428F71B63E262002A5294 /* image1.jpg */; }; FED429071B63E262002A5294 /* image2.png in Resources */ = {isa = PBXBuildFile; fileRef = FED428F81B63E262002A5294 /* image2.png */; }; @@ -40,19 +40,19 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - FE1C9C2A1B645F0700BB2D67 /* FBShimmering-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FBShimmering-Prefix.pch"; sourceTree = ""; }; - FE1C9C2B1B645F0700BB2D67 /* FBShimmering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmering.h; sourceTree = ""; }; - FE1C9C2C1B645F0700BB2D67 /* FBShimmeringLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmeringLayer.h; sourceTree = ""; }; - FE1C9C2D1B645F0700BB2D67 /* FBShimmeringLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBShimmeringLayer.m; sourceTree = ""; }; - FE1C9C2E1B645F0700BB2D67 /* FBShimmeringView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmeringView.h; sourceTree = ""; }; - FE1C9C2F1B645F0700BB2D67 /* FBShimmeringView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBShimmeringView.m; sourceTree = ""; }; - FE1C9C301B645F0700BB2D67 /* MMMaterialDesignSpinner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMMaterialDesignSpinner.h; sourceTree = ""; }; - FE1C9C311B645F0700BB2D67 /* MMMaterialDesignSpinner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMMaterialDesignSpinner.m; sourceTree = ""; }; - FE1C9C321B645F0700BB2D67 /* WSIndefiniteAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WSIndefiniteAnimationView.h; sourceTree = ""; }; - FE1C9C331B645F0700BB2D67 /* WSIndefiniteAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSIndefiniteAnimationView.m; sourceTree = ""; }; - FE1C9C341B645F0700BB2D67 /* WSProgressBundle.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = WSProgressBundle.bundle; sourceTree = ""; }; - FE1C9C351B645F0700BB2D67 /* WSProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WSProgressHUD.h; sourceTree = ""; }; - FE1C9C361B645F0700BB2D67 /* WSProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSProgressHUD.m; sourceTree = ""; }; + FE52FF181B648EDD00703FB5 /* FBShimmering-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FBShimmering-Prefix.pch"; sourceTree = ""; }; + FE52FF191B648EDD00703FB5 /* FBShimmering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmering.h; sourceTree = ""; }; + FE52FF1A1B648EDD00703FB5 /* FBShimmeringLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmeringLayer.h; sourceTree = ""; }; + FE52FF1B1B648EDD00703FB5 /* FBShimmeringLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBShimmeringLayer.m; sourceTree = ""; }; + FE52FF1C1B648EDD00703FB5 /* FBShimmeringView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmeringView.h; sourceTree = ""; }; + FE52FF1D1B648EDD00703FB5 /* FBShimmeringView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBShimmeringView.m; sourceTree = ""; }; + FE52FF1E1B648EDD00703FB5 /* MMMaterialDesignSpinner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMMaterialDesignSpinner.h; sourceTree = ""; }; + FE52FF1F1B648EDD00703FB5 /* MMMaterialDesignSpinner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMMaterialDesignSpinner.m; sourceTree = ""; }; + FE52FF201B648EDD00703FB5 /* WSIndefiniteAnimationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WSIndefiniteAnimationView.h; sourceTree = ""; }; + FE52FF211B648EDD00703FB5 /* WSIndefiniteAnimationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSIndefiniteAnimationView.m; sourceTree = ""; }; + FE52FF221B648EDD00703FB5 /* WSProgressBundle.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = WSProgressBundle.bundle; sourceTree = ""; }; + FE52FF231B648EDD00703FB5 /* WSProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WSProgressHUD.h; sourceTree = ""; }; + FE52FF241B648EDD00703FB5 /* WSProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WSProgressHUD.m; sourceTree = ""; }; FED428F11B63E262002A5294 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; FED428F21B63E262002A5294 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; FED428F41B63E262002A5294 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; @@ -93,22 +93,36 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - FE1C9C291B645F0700BB2D67 /* WSProgressHUD */ = { + FE0FED181B647DB800E502BA /* Support file */ = { isa = PBXGroup; children = ( - FE1C9C2A1B645F0700BB2D67 /* FBShimmering-Prefix.pch */, - FE1C9C2B1B645F0700BB2D67 /* FBShimmering.h */, - FE1C9C2C1B645F0700BB2D67 /* FBShimmeringLayer.h */, - FE1C9C2D1B645F0700BB2D67 /* FBShimmeringLayer.m */, - FE1C9C2E1B645F0700BB2D67 /* FBShimmeringView.h */, - FE1C9C2F1B645F0700BB2D67 /* FBShimmeringView.m */, - FE1C9C301B645F0700BB2D67 /* MMMaterialDesignSpinner.h */, - FE1C9C311B645F0700BB2D67 /* MMMaterialDesignSpinner.m */, - FE1C9C321B645F0700BB2D67 /* WSIndefiniteAnimationView.h */, - FE1C9C331B645F0700BB2D67 /* WSIndefiniteAnimationView.m */, - FE1C9C341B645F0700BB2D67 /* WSProgressBundle.bundle */, - FE1C9C351B645F0700BB2D67 /* WSProgressHUD.h */, - FE1C9C361B645F0700BB2D67 /* WSProgressHUD.m */, + FED428F31B63E262002A5294 /* LaunchScreen.xib */, + FED428F71B63E262002A5294 /* image1.jpg */, + FED428F81B63E262002A5294 /* image2.png */, + FED428F91B63E262002A5294 /* Images.xcassets */, + FED428FA1B63E262002A5294 /* IMG_6584.png */, + FED428FB1B63E262002A5294 /* Info.plist */, + FED428FC1B63E262002A5294 /* main.m */, + ); + name = "Support file"; + sourceTree = ""; + }; + FE52FF171B648EDD00703FB5 /* WSProgressHUD */ = { + isa = PBXGroup; + children = ( + FE52FF181B648EDD00703FB5 /* FBShimmering-Prefix.pch */, + FE52FF191B648EDD00703FB5 /* FBShimmering.h */, + FE52FF1A1B648EDD00703FB5 /* FBShimmeringLayer.h */, + FE52FF1B1B648EDD00703FB5 /* FBShimmeringLayer.m */, + FE52FF1C1B648EDD00703FB5 /* FBShimmeringView.h */, + FE52FF1D1B648EDD00703FB5 /* FBShimmeringView.m */, + FE52FF1E1B648EDD00703FB5 /* MMMaterialDesignSpinner.h */, + FE52FF1F1B648EDD00703FB5 /* MMMaterialDesignSpinner.m */, + FE52FF201B648EDD00703FB5 /* WSIndefiniteAnimationView.h */, + FE52FF211B648EDD00703FB5 /* WSIndefiniteAnimationView.m */, + FE52FF221B648EDD00703FB5 /* WSProgressBundle.bundle */, + FE52FF231B648EDD00703FB5 /* WSProgressHUD.h */, + FE52FF241B648EDD00703FB5 /* WSProgressHUD.m */, ); path = WSProgressHUD; sourceTree = ""; @@ -118,20 +132,14 @@ children = ( FED428F11B63E262002A5294 /* AppDelegate.h */, FED428F21B63E262002A5294 /* AppDelegate.m */, - FED428F31B63E262002A5294 /* LaunchScreen.xib */, - FED428F51B63E262002A5294 /* Main.storyboard */, - FED428F71B63E262002A5294 /* image1.jpg */, - FED428F81B63E262002A5294 /* image2.png */, - FED428F91B63E262002A5294 /* Images.xcassets */, - FED428FA1B63E262002A5294 /* IMG_6584.png */, - FED428FB1B63E262002A5294 /* Info.plist */, - FED428FC1B63E262002A5294 /* main.m */, + FED429011B63E262002A5294 /* ViewController.h */, + FED429021B63E262002A5294 /* ViewController.m */, FED428FD1B63E262002A5294 /* TabViewController1.h */, FED428FE1B63E262002A5294 /* TabViewController1.m */, FED428FF1B63E262002A5294 /* TabViewController2.h */, FED429001B63E262002A5294 /* TabViewController2.m */, - FED429011B63E262002A5294 /* ViewController.h */, - FED429021B63E262002A5294 /* ViewController.m */, + FED428F51B63E262002A5294 /* Main.storyboard */, + FE0FED181B647DB800E502BA /* Support file */, ); path = WSProgressHUDDemo; sourceTree = ""; @@ -139,7 +147,7 @@ FEDB74921B593589003DDB79 = { isa = PBXGroup; children = ( - FE1C9C291B645F0700BB2D67 /* WSProgressHUD */, + FE52FF171B648EDD00703FB5 /* WSProgressHUD */, FED428F01B63E262002A5294 /* WSProgressHUDDemo */, FEDB74B71B593589003DDB79 /* WSProgressHUDTests */, FEDB749C1B593589003DDB79 /* Products */, @@ -252,7 +260,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - FE1C9C3B1B645F0700BB2D67 /* WSProgressBundle.bundle in Resources */, + FE52FF291B648EDD00703FB5 /* WSProgressBundle.bundle in Resources */, FED429261B63E2A0002A5294 /* LaunchScreen.xib in Resources */, FED429271B63E2A0002A5294 /* Main.storyboard in Resources */, FED429281B63E2A0002A5294 /* Info.plist in Resources */, @@ -278,15 +286,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - FE1C9C371B645F0700BB2D67 /* FBShimmeringLayer.m in Sources */, + FE52FF251B648EDD00703FB5 /* FBShimmeringLayer.m in Sources */, FED429031B63E262002A5294 /* AppDelegate.m in Sources */, - FE1C9C3C1B645F0700BB2D67 /* WSProgressHUD.m in Sources */, + FE52FF2A1B648EDD00703FB5 /* WSProgressHUD.m in Sources */, FED4290E1B63E262002A5294 /* ViewController.m in Sources */, - FE1C9C381B645F0700BB2D67 /* FBShimmeringView.m in Sources */, + FE52FF261B648EDD00703FB5 /* FBShimmeringView.m in Sources */, FED4290D1B63E262002A5294 /* TabViewController2.m in Sources */, FED4290B1B63E262002A5294 /* main.m in Sources */, - FE1C9C391B645F0700BB2D67 /* MMMaterialDesignSpinner.m in Sources */, - FE1C9C3A1B645F0700BB2D67 /* WSIndefiniteAnimationView.m in Sources */, + FE52FF271B648EDD00703FB5 /* MMMaterialDesignSpinner.m in Sources */, + FE52FF281B648EDD00703FB5 /* WSIndefiniteAnimationView.m in Sources */, FED4290C1B63E262002A5294 /* TabViewController1.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Demo/WSProgressHUD/WSProgressHUD.m b/Demo/WSProgressHUD/WSProgressHUD.m index d03329c..3e96a6f 100644 --- a/Demo/WSProgressHUD/WSProgressHUD.m +++ b/Demo/WSProgressHUD/WSProgressHUD.m @@ -297,7 +297,7 @@ - (void)showWithMaskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgre - (void)showWithString: (NSString *)string maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { - NSAssert([NSThread mainThread], @"Show Must In main thread"); + NSAssert([NSThread mainThread], @"Show Must on main thread"); objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeStatus), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN); @@ -314,7 +314,7 @@ - (void)showWithString: (NSString *)string maskType: (WSProgressHUDMaskType)mask - (void)showShimmeringString: (NSString *)string maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { - + NSAssert([NSThread mainThread], @"Show Must on main thread"); objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeString), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN); @@ -338,6 +338,7 @@ - (void)showShimmeringString: (NSString *)string maskType: (WSProgressHUDMaskTyp - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { + NSAssert([NSThread mainThread], @"Show Must on main thread"); if (self.hudIsShowing && self.hudType == WSProgressHUDTypeProgress) { self.ringLayer.strokeEnd = progress; return; @@ -360,6 +361,7 @@ - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProg - (void)showImage:(UIImage *)image status:(NSString *)title maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { + NSAssert([NSThread mainThread], @"Show Must on main thread"); objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(showImage), @(1), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeImage), OBJC_ASSOCIATION_ASSIGN); diff --git a/Demo/WSProgressHUDDemo/ViewController.m b/Demo/WSProgressHUDDemo/ViewController.m index 5e7978b..6ad2816 100644 --- a/Demo/WSProgressHUDDemo/ViewController.m +++ b/Demo/WSProgressHUDDemo/ViewController.m @@ -43,7 +43,8 @@ - (void)didReceiveMemoryWarning { // Dispose of any resources that can be recreated. } - (IBAction)show:(id)sender { - + +// [WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorCustom]; [WSProgressHUD showWithMaskType:WSProgressHUDMaskTypeBlack]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ @@ -59,6 +60,10 @@ - (IBAction)showShimmeringString:(id)sender { } - (IBAction)showWithString:(id)sender { [WSProgressHUD showWithStatus:@"Loading..." maskType:WSProgressHUDMaskTypeBlack maskWithout:WSProgressHUDMaskWithoutTabbar]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [WSProgressHUD dismiss]; + }); + } - (IBAction)showProgress:(id)sender { [self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3f]; diff --git a/WSProgressHUD.podspec b/WSProgressHUD.podspec index c57e232..41ea363 100644 --- a/WSProgressHUD.podspec +++ b/WSProgressHUD.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "WSProgressHUD" - s.version = "1.0.3" + s.version = "1.0.4" s.summary = "WSProgressHUD is a beauful hud view for iPhone & iPad." s.description = <<-DESC @@ -30,109 +30,18 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/devSC/WSProgressHUD" s.screenshots = "https://raw.githubusercontent.com/devSC/WSProgressHUD/master/Demo/Demo.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 = { "袁仕崇" => "xiaochong2154@163.com" } - # Or just: s.author = "袁仕崇" - # s.authors = { "袁仕崇" => "xiaochong2154@163.com" } - # s.social_media_url = "http://twitter.com/袁仕崇" - - # ――― 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, "6.0" - - # When using multiple platforms - # s.ios.deployment_target = "5.0" - # s.osx.deployment_target = "10.7" - # s.watchos.deployment_target = "2.0" - - - # ――― 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/devSC/WSProgressHUD.git", :tag => "1.0.3" } - - - # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - # - # CocoaPods is smart about how it includes source code. For source files - # giving a folder will include any swift, 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 = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.4" } s.source_files = "WSProgressHUD/*" s.exclude_files = "Demo/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 = "WSProgressHUD/*.bundle" - - # 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 = "UIKit", "QuartzCore","CoreGraphics","Foundation" - # 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 = true - - # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } - # s.dependency pod 'Shimmer' + s.requires_arc = true + s.dependency 'Shimmer' end diff --git a/WSProgressHUD/FBShimmering-Prefix.pch b/WSProgressHUD/FBShimmering-Prefix.pch deleted file mode 100755 index 625be4d..0000000 --- a/WSProgressHUD/FBShimmering-Prefix.pch +++ /dev/null @@ -1,9 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every source file. -// - -#ifdef __OBJC__ - #import -#endif diff --git a/WSProgressHUD/FBShimmering.h b/WSProgressHUD/FBShimmering.h deleted file mode 100755 index 42a4ddc..0000000 --- a/WSProgressHUD/FBShimmering.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - Copyright (c) 2014-present, Facebook, Inc. - All rights reserved. - - This source code is licensed under the BSD-style license found in the - LICENSE file in the root directory of this source tree. An additional grant - of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import - -typedef NS_ENUM(NSInteger, FBShimmerDirection) { - FBShimmerDirectionRight, // Shimmer animation goes from left to right - FBShimmerDirectionLeft, // Shimmer animation goes from right to left - FBShimmerDirectionUp, // Shimmer animation goes from below to above - FBShimmerDirectionDown, // Shimmer animation goes from above to below -}; - -static const float FBShimmerDefaultBeginTime = CGFLOAT_MAX; - -@protocol FBShimmering - -//! @abstract Set this to YES to start shimming and NO to stop. Defaults to NO. -@property (assign, nonatomic, readwrite, getter = isShimmering) BOOL shimmering; - -//! @abstract The time interval between shimmerings in seconds. Defaults to 0.4. -@property (assign, nonatomic, readwrite) CFTimeInterval shimmeringPauseDuration; - -//! @abstract The opacity of the content while it is shimmering. Defaults to 0.5. -@property (assign, nonatomic, readwrite) CGFloat shimmeringAnimationOpacity; - -//! @abstract The opacity of the content before it is shimmering. Defaults to 1.0. -@property (assign, nonatomic, readwrite) CGFloat shimmeringOpacity; - -//! @abstract The speed of shimmering, in points per second. Defaults to 230. -@property (assign, nonatomic, readwrite) CGFloat shimmeringSpeed; - -//! @abstract The highlight length of shimmering. Range of [0,1], defaults to 1.0. -@property (assign, nonatomic, readwrite) CGFloat shimmeringHighlightLength; - -//! @abstract @deprecated Same as "shimmeringHighlightLength", just for downward compatibility -@property (assign, nonatomic, readwrite, getter = shimmeringHighlightLength, setter = setShimmeringHighlightLength:) CGFloat shimmeringHighlightWidth; - -//! @abstract The direction of shimmering animation. Defaults to FBShimmerDirectionRight. -@property (assign, nonatomic, readwrite) FBShimmerDirection shimmeringDirection; - -//! @abstract The duration of the fade used when shimmer begins. Defaults to 0.1. -@property (assign, nonatomic, readwrite) CFTimeInterval shimmeringBeginFadeDuration; - -//! @abstract The duration of the fade used when shimmer ends. Defaults to 0.3. -@property (assign, nonatomic, readwrite) CFTimeInterval shimmeringEndFadeDuration; - -/** - @abstract The absolute CoreAnimation media time when the shimmer will fade in. - @discussion Only valid after setting {@ref shimmering} to NO. - */ -@property (assign, nonatomic, readonly) CFTimeInterval shimmeringFadeTime; - -/** - @abstract The absolute CoreAnimation media time when the shimmer will begin. - @discussion Only valid after setting {@ref shimmering} to YES. - */ -@property (assign, nonatomic) CFTimeInterval shimmeringBeginTime; - -@end - diff --git a/WSProgressHUD/FBShimmeringLayer.h b/WSProgressHUD/FBShimmeringLayer.h deleted file mode 100755 index 8e74179..0000000 --- a/WSProgressHUD/FBShimmeringLayer.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - Copyright (c) 2014-present, Facebook, Inc. - All rights reserved. - - This source code is licensed under the BSD-style license found in the - LICENSE file in the root directory of this source tree. An additional grant - of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#import "FBShimmering.h" - -/** - @abstract Lightweight, generic shimmering layer. - */ -@interface FBShimmeringLayer : CALayer - -//! @abstract The content layer to be shimmered. -@property (strong, nonatomic) CALayer *contentLayer; - -@end diff --git a/WSProgressHUD/FBShimmeringLayer.m b/WSProgressHUD/FBShimmeringLayer.m deleted file mode 100755 index 076803e..0000000 --- a/WSProgressHUD/FBShimmeringLayer.m +++ /dev/null @@ -1,484 +0,0 @@ -/** - Copyright (c) 2014-present, Facebook, Inc. - All rights reserved. - - This source code is licensed under the BSD-style license found in the - LICENSE file in the root directory of this source tree. An additional grant - of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "FBShimmeringLayer.h" - -#import -#import -#import - -#import -#import - -#if !__has_feature(objc_arc) -#error This file must be compiled with ARC. Convert your project to ARC or specify the -fobjc-arc flag. -#endif - -#if TARGET_IPHONE_SIMULATOR -UIKIT_EXTERN float UIAnimationDragCoefficient(void); // UIKit private drag coeffient, use judiciously -#endif - -static CGFloat FBShimmeringLayerDragCoefficient(void) -{ -#if TARGET_IPHONE_SIMULATOR - return UIAnimationDragCoefficient(); -#else - return 1.0; -#endif -} - -static void FBShimmeringLayerAnimationApplyDragCoefficient(CAAnimation *animation) -{ - CGFloat k = FBShimmeringLayerDragCoefficient(); - - if (k != 0 && k != 1) { - animation.speed = 1 / k; - } -} - -// animations keys -static NSString *const kFBShimmerSlideAnimationKey = @"slide"; -static NSString *const kFBFadeAnimationKey = @"fade"; -static NSString *const kFBEndFadeAnimationKey = @"fade-end"; - -static CABasicAnimation *fade_animation(id delegate, CALayer *layer, CGFloat opacity, CFTimeInterval duration) -{ - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"]; - animation.delegate = delegate; - animation.fromValue = @([(layer.presentationLayer ?: layer) opacity]); - animation.toValue = @(opacity); - animation.fillMode = kCAFillModeBoth; - animation.removedOnCompletion = NO; - animation.duration = duration; - FBShimmeringLayerAnimationApplyDragCoefficient(animation); - return animation; -} - -static CABasicAnimation *shimmer_begin_fade_animation(id delegate, CALayer *layer, CGFloat opacity, CGFloat duration) -{ - return fade_animation(delegate, layer, opacity, duration); -} - -static CABasicAnimation *shimmer_end_fade_animation(id delegate, CALayer *layer, CGFloat opacity, CGFloat duration) -{ - CABasicAnimation *animation = fade_animation(delegate, layer, opacity, duration); - [animation setValue:@YES forKey:kFBEndFadeAnimationKey]; - return animation; -} - -static CABasicAnimation *shimmer_slide_animation(id delegate, CFTimeInterval duration, FBShimmerDirection direction) -{ - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; - animation.delegate = delegate; - animation.toValue = [NSValue valueWithCGPoint:CGPointZero]; - animation.duration = duration; - animation.repeatCount = HUGE_VALF; - FBShimmeringLayerAnimationApplyDragCoefficient(animation); - if (direction == FBShimmerDirectionLeft || - direction == FBShimmerDirectionUp) { - animation.speed = -fabsf(animation.speed); - } - return animation; -} - -// take a shimmer slide animation and turns into repeating -static CAAnimation *shimmer_slide_repeat(CAAnimation *a, CFTimeInterval duration, FBShimmerDirection direction) -{ - CAAnimation *anim = [a copy]; - anim.repeatCount = HUGE_VALF; - anim.duration = duration; - anim.speed = (direction == FBShimmerDirectionRight || direction == FBShimmerDirectionDown) ? fabsf(anim.speed) : -fabsf(anim.speed); - return anim; -} - -// take a shimmer slide animation and turns into finish -static CAAnimation *shimmer_slide_finish(CAAnimation *a) -{ - CAAnimation *anim = [a copy]; - anim.repeatCount = 0; - return anim; -} - -@interface FBShimmeringMaskLayer : CAGradientLayer -@property (readonly, nonatomic) CALayer *fadeLayer; -@end - -@implementation FBShimmeringMaskLayer - -- (instancetype)init -{ - self = [super init]; - if (nil != self) { - _fadeLayer = [[CALayer alloc] init]; - _fadeLayer.backgroundColor = [UIColor whiteColor].CGColor; - [self addSublayer:_fadeLayer]; - } - return self; -} - -- (void)layoutSublayers -{ - [super layoutSublayers]; - CGRect r = self.bounds; - _fadeLayer.bounds = r; - _fadeLayer.position = CGPointMake(CGRectGetMidX(r), CGRectGetMidY(r)); -} - -@end - -@interface FBShimmeringLayer () -@property (strong, nonatomic) FBShimmeringMaskLayer *maskLayer; -@end - -@implementation FBShimmeringLayer -{ - CALayer *_contentLayer; - FBShimmeringMaskLayer *_maskLayer; -} - -#pragma mark - Lifecycle - -@synthesize shimmering = _shimmering; -@synthesize shimmeringPauseDuration = _shimmeringPauseDuration; -@synthesize shimmeringAnimationOpacity = _shimmeringAnimationOpacity; -@synthesize shimmeringOpacity = _shimmeringOpacity; -@synthesize shimmeringSpeed = _shimmeringSpeed; -@synthesize shimmeringHighlightLength = _shimmeringHighlightLength; -@synthesize shimmeringDirection = _shimmeringDirection; -@synthesize shimmeringFadeTime = _shimmeringFadeTime; -@synthesize shimmeringBeginFadeDuration = _shimmeringBeginFadeDuration; -@synthesize shimmeringEndFadeDuration = _shimmeringEndFadeDuration; -@synthesize shimmeringBeginTime = _shimmeringBeginTime; -@dynamic shimmeringHighlightWidth; - -- (instancetype)init -{ - self = [super init]; - if (nil != self) { - // default configuration - _shimmeringPauseDuration = 0.4; - _shimmeringSpeed = 230.0; - _shimmeringHighlightLength = 1.0; - _shimmeringAnimationOpacity = 0.5; - _shimmeringOpacity = 1.0; - _shimmeringDirection = FBShimmerDirectionRight; - _shimmeringBeginFadeDuration = 0.1; - _shimmeringEndFadeDuration = 0.3; - _shimmeringBeginTime = FBShimmerDefaultBeginTime; - } - return self; -} - -#pragma mark - Properties - -- (void)setContentLayer:(CALayer *)contentLayer -{ - // reset mask - self.maskLayer = nil; - - // note content layer and add for display - _contentLayer = contentLayer; - self.sublayers = contentLayer ? @[contentLayer] : nil; - - // update shimmering animation - [self _updateShimmering]; -} - -- (void)setShimmering:(BOOL)shimmering -{ - if (shimmering != _shimmering) { - _shimmering = shimmering; - [self _updateShimmering]; - } -} - -- (void)setShimmeringSpeed:(CGFloat)speed -{ - if (speed != _shimmeringSpeed) { - _shimmeringSpeed = speed; - [self _updateShimmering]; - } -} - -- (void)setShimmeringHighlightLength:(CGFloat)length -{ - if (length != _shimmeringHighlightLength) { - _shimmeringHighlightLength = length; - [self _updateShimmering]; - } -} - -- (void)setShimmeringDirection:(FBShimmerDirection)direction -{ - if (direction != _shimmeringDirection) { - _shimmeringDirection = direction; - [self _updateShimmering]; - } -} - -- (void)setShimmeringPauseDuration:(CFTimeInterval)duration -{ - if (duration != _shimmeringPauseDuration) { - _shimmeringPauseDuration = duration; - [self _updateShimmering]; - } -} - -- (void)setShimmeringAnimationOpacity:(CGFloat)shimmeringAnimationOpacity -{ - if (shimmeringAnimationOpacity != _shimmeringAnimationOpacity) { - _shimmeringAnimationOpacity = shimmeringAnimationOpacity; - [self _updateMaskColors]; - } -} - -- (void)setShimmeringOpacity:(CGFloat)shimmeringOpacity -{ - if (shimmeringOpacity != _shimmeringOpacity) { - _shimmeringOpacity = shimmeringOpacity; - [self _updateMaskColors]; - } -} - -- (void)setShimmeringBeginTime:(CFTimeInterval)beginTime -{ - if (beginTime != _shimmeringBeginTime) { - _shimmeringBeginTime = beginTime; - [self _updateShimmering]; - } -} - -- (void)layoutSublayers -{ - [super layoutSublayers]; - CGRect r = self.bounds; - _contentLayer.anchorPoint = CGPointMake(0.5, 0.5); - _contentLayer.bounds = r; - _contentLayer.position = CGPointMake(CGRectGetMidX(r), CGRectGetMidY(r)); - - if (nil != _maskLayer) { - [self _updateMaskLayout]; - } -} - -- (void)setBounds:(CGRect)bounds -{ - CGRect oldBounds = self.bounds; - [super setBounds:bounds]; - - if (!CGRectEqualToRect(oldBounds, bounds)) { - [self _updateShimmering]; - } -} - -#pragma mark - Internal - -- (void)_clearMask -{ - if (nil == _maskLayer) { - return; - } - - BOOL disableActions = [CATransaction disableActions]; - [CATransaction setDisableActions:YES]; - - self.maskLayer = nil; - _contentLayer.mask = nil; - - [CATransaction setDisableActions:disableActions]; -} - -- (void)_createMaskIfNeeded -{ - if (_shimmering && !_maskLayer) { - _maskLayer = [FBShimmeringMaskLayer layer]; - _maskLayer.delegate = self; - _contentLayer.mask = _maskLayer; - [self _updateMaskColors]; - [self _updateMaskLayout]; - } -} - -- (void)_updateMaskColors -{ - if (nil == _maskLayer) { - return; - } - - // We create a gradient to be used as a mask. - // In a mask, the colors do not matter, it's the alpha that decides the degree of masking. - UIColor *maskedColor = [UIColor colorWithWhite:1.0 alpha:_shimmeringOpacity]; - UIColor *unmaskedColor = [UIColor colorWithWhite:1.0 alpha:_shimmeringAnimationOpacity]; - - // Create a gradient from masked to unmasked to masked. - _maskLayer.colors = @[(__bridge id)maskedColor.CGColor, (__bridge id)unmaskedColor.CGColor, (__bridge id)maskedColor.CGColor]; -} - -- (void)_updateMaskLayout -{ - // Everything outside the mask layer is hidden, so we need to create a mask long enough for the shimmered layer to be always covered by the mask. - CGFloat length = 0.0f; - if (_shimmeringDirection == FBShimmerDirectionDown || - _shimmeringDirection == FBShimmerDirectionUp) { - length = CGRectGetHeight(_contentLayer.bounds); - } else { - length = CGRectGetWidth(_contentLayer.bounds); - } - if (0 == length) { - return; - } - - // extra distance for the gradient to travel during the pause. - CGFloat extraDistance = length + _shimmeringSpeed * _shimmeringPauseDuration; - - // compute how far the shimmering goes - CGFloat fullShimmerLength = length * 3.0f + extraDistance; - CGFloat travelDistance = length * 2.0f + extraDistance; - - // position the gradient for the desired width - CGFloat highlightOutsideLength = (1.0 - _shimmeringHighlightLength) / 2.0; - _maskLayer.locations = @[@(highlightOutsideLength), - @(0.5), - @(1.0 - highlightOutsideLength)]; - - CGFloat startPoint = (length + extraDistance) / fullShimmerLength; - CGFloat endPoint = travelDistance / fullShimmerLength; - - // position for the start of the animation - _maskLayer.anchorPoint = CGPointZero; - if (_shimmeringDirection == FBShimmerDirectionDown || - _shimmeringDirection == FBShimmerDirectionUp) { - _maskLayer.startPoint = CGPointMake(0.0, startPoint); - _maskLayer.endPoint = CGPointMake(0.0, endPoint); - _maskLayer.position = CGPointMake(0.0, -travelDistance); - _maskLayer.bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_contentLayer.bounds), fullShimmerLength); - } else { - _maskLayer.startPoint = CGPointMake(startPoint, 0.0); - _maskLayer.endPoint = CGPointMake(endPoint, 0.0); - _maskLayer.position = CGPointMake(-travelDistance, 0.0); - _maskLayer.bounds = CGRectMake(0.0, 0.0, fullShimmerLength, CGRectGetHeight(_contentLayer.bounds)); - } -} - -- (void)_updateShimmering -{ - // create mask if needed - [self _createMaskIfNeeded]; - - // if not shimmering and no mask, noop - if (!_shimmering && !_maskLayer) { - return; - } - - // ensure layed out - [self layoutIfNeeded]; - - BOOL disableActions = [CATransaction disableActions]; - if (!_shimmering) { - if (disableActions) { - // simply remove mask - [self _clearMask]; - } else { - // end slide - CFTimeInterval slideEndTime = 0; - - CAAnimation *slideAnimation = [_maskLayer animationForKey:kFBShimmerSlideAnimationKey]; - if (slideAnimation != nil) { - - // determing total time sliding - CFTimeInterval now = CACurrentMediaTime(); - CFTimeInterval slideTotalDuration = now - slideAnimation.beginTime; - - // determine time offset into current slide - CFTimeInterval slideTimeOffset = fmod(slideTotalDuration, slideAnimation.duration); - - // transition to non-repeating slide - CAAnimation *finishAnimation = shimmer_slide_finish(slideAnimation); - - // adjust begin time to now - offset - finishAnimation.beginTime = now - slideTimeOffset; - - // note slide end time and begin - slideEndTime = finishAnimation.beginTime + slideAnimation.duration; - [_maskLayer addAnimation:finishAnimation forKey:kFBShimmerSlideAnimationKey]; - } - - // fade in text at slideEndTime - CABasicAnimation *fadeInAnimation = shimmer_end_fade_animation(self, _maskLayer.fadeLayer, 1.0, _shimmeringEndFadeDuration); - fadeInAnimation.beginTime = slideEndTime; - [_maskLayer.fadeLayer addAnimation:fadeInAnimation forKey:kFBFadeAnimationKey]; - - // expose end time for synchronization - _shimmeringFadeTime = slideEndTime; - } - } else { - // fade out text, optionally animated - CABasicAnimation *fadeOutAnimation = nil; - if (_shimmeringBeginFadeDuration > 0.0 && !disableActions) { - fadeOutAnimation = shimmer_begin_fade_animation(self, _maskLayer.fadeLayer, 0.0, _shimmeringBeginFadeDuration); - [_maskLayer.fadeLayer addAnimation:fadeOutAnimation forKey:kFBFadeAnimationKey]; - } else { - BOOL innerDisableActions = [CATransaction disableActions]; - [CATransaction setDisableActions:YES]; - - _maskLayer.fadeLayer.opacity = 0.0; - [_maskLayer.fadeLayer removeAllAnimations]; - - [CATransaction setDisableActions:innerDisableActions]; - } - - // begin slide animation - CAAnimation *slideAnimation = [_maskLayer animationForKey:kFBShimmerSlideAnimationKey]; - - // compute shimmer duration - CGFloat length = 0.0f; - if (_shimmeringDirection == FBShimmerDirectionDown || - _shimmeringDirection == FBShimmerDirectionUp) { - length = CGRectGetHeight(_contentLayer.bounds); - } else { - length = CGRectGetWidth(_contentLayer.bounds); - } - CFTimeInterval animationDuration = (length / _shimmeringSpeed) + _shimmeringPauseDuration; - - if (slideAnimation != nil) { - // ensure existing slide animation repeats - [_maskLayer addAnimation:shimmer_slide_repeat(slideAnimation, animationDuration, _shimmeringDirection) forKey:kFBShimmerSlideAnimationKey]; - } else { - // add slide animation - slideAnimation = shimmer_slide_animation(self, animationDuration, _shimmeringDirection); - slideAnimation.fillMode = kCAFillModeForwards; - slideAnimation.removedOnCompletion = NO; - if (_shimmeringBeginTime == FBShimmerDefaultBeginTime) { - _shimmeringBeginTime = CACurrentMediaTime() + fadeOutAnimation.duration; - } - slideAnimation.beginTime = _shimmeringBeginTime; - - [_maskLayer addAnimation:slideAnimation forKey:kFBShimmerSlideAnimationKey]; - } - } -} - -#pragma mark - CALayerDelegate - -- (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event -{ - // no associated actions - return (id)kCFNull; -} - -#pragma mark - CAAnimationDelegate - -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag -{ - if (flag && [[anim valueForKey:kFBEndFadeAnimationKey] boolValue]) { - [self _clearMask]; - } -} - -@end diff --git a/WSProgressHUD/FBShimmeringView.h b/WSProgressHUD/FBShimmeringView.h deleted file mode 100755 index 5431668..0000000 --- a/WSProgressHUD/FBShimmeringView.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - Copyright (c) 2014-present, Facebook, Inc. - All rights reserved. - - This source code is licensed under the BSD-style license found in the - LICENSE file in the root directory of this source tree. An additional grant - of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#import "FBShimmering.h" - -/** - @abstract Lightweight, generic shimmering view. - */ -@interface FBShimmeringView : UIView - -//! @abstract The content view to be shimmered. -@property (strong, nonatomic) UIView *contentView; - -@end diff --git a/WSProgressHUD/FBShimmeringView.m b/WSProgressHUD/FBShimmeringView.m deleted file mode 100755 index 5dcf247..0000000 --- a/WSProgressHUD/FBShimmeringView.m +++ /dev/null @@ -1,62 +0,0 @@ -/** - Copyright (c) 2014-present, Facebook, Inc. - All rights reserved. - - This source code is licensed under the BSD-style license found in the - LICENSE file in the root directory of this source tree. An additional grant - of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "FBShimmeringView.h" - -#import "FBShimmeringLayer.h" - -#if !__has_feature(objc_arc) -#error This file must be compiled with ARC. Convert your project to ARC or specify the -fobjc-arc flag. -#endif - -@implementation FBShimmeringView - -+ (Class)layerClass -{ - return [FBShimmeringLayer class]; -} - -#define __layer ((FBShimmeringLayer *)self.layer) - -#define LAYER_ACCESSOR(accessor, ctype) \ -- (ctype)accessor { \ - return [__layer accessor]; \ -} - -#define LAYER_MUTATOR(mutator, ctype) \ -- (void)mutator (ctype)value { \ - [__layer mutator value]; \ -} - -#define LAYER_RW_PROPERTY(accessor, mutator, ctype) \ - LAYER_ACCESSOR (accessor, ctype) \ - LAYER_MUTATOR (mutator, ctype) - -LAYER_RW_PROPERTY(isShimmering, setShimmering:, BOOL) -LAYER_RW_PROPERTY(shimmeringPauseDuration, setShimmeringPauseDuration:, CFTimeInterval) -LAYER_RW_PROPERTY(shimmeringAnimationOpacity, setShimmeringAnimationOpacity:, CGFloat) -LAYER_RW_PROPERTY(shimmeringOpacity, setShimmeringOpacity:, CGFloat) -LAYER_RW_PROPERTY(shimmeringSpeed, setShimmeringSpeed:, CGFloat) -LAYER_RW_PROPERTY(shimmeringHighlightLength, setShimmeringHighlightLength:, CGFloat) -LAYER_RW_PROPERTY(shimmeringDirection, setShimmeringDirection:, FBShimmerDirection) -LAYER_ACCESSOR(shimmeringFadeTime, CFTimeInterval) -LAYER_RW_PROPERTY(shimmeringBeginFadeDuration, setShimmeringBeginFadeDuration:, CFTimeInterval) -LAYER_RW_PROPERTY(shimmeringEndFadeDuration, setShimmeringEndFadeDuration:, CFTimeInterval) -LAYER_RW_PROPERTY(shimmeringBeginTime, setShimmeringBeginTime:, CFTimeInterval) - -- (void)setContentView:(UIView *)contentView -{ - if (contentView != _contentView) { - _contentView = contentView; - [self addSubview:contentView]; - __layer.contentLayer = contentView.layer; - } -} - -@end diff --git a/WSProgressHUD/WSProgressHUD.m b/WSProgressHUD/WSProgressHUD.m index d03329c..3e96a6f 100644 --- a/WSProgressHUD/WSProgressHUD.m +++ b/WSProgressHUD/WSProgressHUD.m @@ -297,7 +297,7 @@ - (void)showWithMaskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgre - (void)showWithString: (NSString *)string maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { - NSAssert([NSThread mainThread], @"Show Must In main thread"); + NSAssert([NSThread mainThread], @"Show Must on main thread"); objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeStatus), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN); @@ -314,7 +314,7 @@ - (void)showWithString: (NSString *)string maskType: (WSProgressHUDMaskType)mask - (void)showShimmeringString: (NSString *)string maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { - + NSAssert([NSThread mainThread], @"Show Must on main thread"); objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeString), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN); @@ -338,6 +338,7 @@ - (void)showShimmeringString: (NSString *)string maskType: (WSProgressHUDMaskTyp - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { + NSAssert([NSThread mainThread], @"Show Must on main thread"); if (self.hudIsShowing && self.hudType == WSProgressHUDTypeProgress) { self.ringLayer.strokeEnd = progress; return; @@ -360,6 +361,7 @@ - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProg - (void)showImage:(UIImage *)image status:(NSString *)title maskType: (WSProgressHUDMaskType)maskType maskWithout: (WSProgressHUDMaskWithoutType)withoutType { + NSAssert([NSThread mainThread], @"Show Must on main thread"); objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(showImage), @(1), OBJC_ASSOCIATION_ASSIGN); objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeImage), OBJC_ASSOCIATION_ASSIGN);