Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
devSC committed Aug 20, 2015
2 parents 7feed2b + f0b862f commit 5a7e4ea
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 26 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Demo/WSProgressHUD/MMMaterialDesignSpinner.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FOUNDATION_EXPORT const unsigned char MMMaterialDesignSpinnerVersionString[];
/** Property indicating whether the view is currently animating. */
@property (nonatomic, readonly) BOOL isAnimating;

@property (nonatomic, strong) UIColor *spinnerColor;
/**
* Convenience function for starting & stopping animation with a boolean variable instead of explicit
* method calls.
Expand Down
7 changes: 6 additions & 1 deletion Demo/WSProgressHUD/MMMaterialDesignSpinner.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,17 @@ - (void)updatePath {
- (CAShapeLayer *)progressLayer {
if (!_progressLayer) {
_progressLayer = [CAShapeLayer layer];
_progressLayer.strokeColor = self.tintColor.CGColor;
_progressLayer.strokeColor = [UIColor blueColor].CGColor;
_progressLayer.fillColor = nil;
_progressLayer.lineWidth = 1.5f;
}
return _progressLayer;
}
- (void)setSpinnerColor:(UIColor *)spinnerColor
{
self.progressLayer.strokeColor = spinnerColor.CGColor;
}


- (BOOL)isAnimating {
return _isAnimating;
Expand Down
Binary file modified Demo/WSProgressHUD/WSProgressBundle.bundle/error@2x.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Demo/WSProgressHUD/WSProgressBundle.bundle/success@2x.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Demo/WSProgressHUD/WSProgressHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ typedef NS_ENUM(NSInteger, WSProgressHUDMaskWithoutType) { //
};

typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
WSProgressHUDIndicatorMMSpinner,
WSProgressHUDIndicatorCustom,
WSProgressHUDIndicatorMMSpinner,
WSProgressHUDIndicatorSmallLight,
};

Expand Down
15 changes: 5 additions & 10 deletions Demo/WSProgressHUD/WSProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ @interface WSProgressHUD ()
static UIImage *WSProgressHUDSuccessImage;
static UIImage *WSProgressHUDErrorImage;

static CGFloat const WSProgressHUDIndicatorBig = 35;
static CGFloat const WSProgressHUDIndicatorBig = 31;
static CGFloat const WSProgressHUDIndicatorSmall = 20;

static CGFloat WSProgressHUDRingThickness = 2;
Expand Down Expand Up @@ -341,15 +341,14 @@ - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProg
self.ringLayer.strokeEnd = progress;
return;
}

objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN);
objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeProgress), OBJC_ASSOCIATION_ASSIGN);
objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN);

[self invalidateTimer];

[self setMaskEdgeWithType:self.maskType];


[self updateSubviewsPositionWithString:string];

[self showHudViewWithAnimation];
Expand Down Expand Up @@ -567,6 +566,7 @@ - (void)updateSubviewsPositionWithString: (NSString *)string
WSProgressHUDStringRect.origin.y = imageOffset;
[self startIndicatorAnimation:NO];
self.labelView.center = CGPointMake(hudCenterX , hudCenterY + 20);
self.labelView.textAlignment = NSTextAlignmentCenter;
self.imageView.center = CGPointMake(hudCenterX, 30);
} else {
self.labelView.text = string;
Expand Down Expand Up @@ -982,7 +982,7 @@ - (void)drawRect:(CGRect)rect
switch (self.maskType) {
case WSProgressHUDMaskTypeClear: {
CGContextRef context = UIGraphicsGetCurrentContext();
[[UIColor colorWithWhite:0 alpha:0.5] set];
[[UIColor clearColor] set];
CGRect bounds = self.bounds;
CGContextFillRect(context, bounds);
}break;
Expand Down Expand Up @@ -1155,11 +1155,6 @@ - (UIImageView *)imageView
if (!_imageView) {
_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
_imageView.hidden = YES;
if ([_imageView respondsToSelector:@selector(setTintColor:)]) {
[_imageView setTintColor:WSProgressHUDForeGroundColor];
} else {

}
}
return _imageView;
}
Expand All @@ -1181,7 +1176,7 @@ - (MMMaterialDesignSpinner *)spinnerView
if (!_spinnerView) {
_spinnerView = [[MMMaterialDesignSpinner alloc] initWithFrame:CGRectZero];
_spinnerView.bounds = CGRectMake(0, 0, 20, 20);
_spinnerView.tintColor = WSProgressHUDForeGroundColor;
[_spinnerView setSpinnerColor:[UIColor whiteColor]];
}
return _spinnerView;
}
Expand Down
2 changes: 1 addition & 1 deletion Demo/WSProgressHUDDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (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(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[WSProgressHUD dismiss];
});
}
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ This is a beauful hud view for iPhone & iPad
To Download the project. Run the WSProgressHUD.xcodeproj in the demo directory.

``` objc

[WSProgressHUD show];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
...

dispatch_async(dispatch_get_main_queue(), ^{
...
[WSProgressHUD dismiss];
});
});

//Show on the self.view

@implementation ViewController
Expand Down Expand Up @@ -76,7 +87,13 @@ it, simply add the following line to your Podfile:
```ruby
pod "WSProgressHUD"
```
## Manually

Drag the WSProgressHUD/Demo/WSProgressHUD folder into your project.
Then take care that WSProgressHUD.bundle is added to Targets->Build Phases->Copy Bundle Resources.
Add the QuartzCore framework to your project.

##Thanks

Expand Down
4 changes: 2 additions & 2 deletions WSProgressHUD.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "WSProgressHUD"
s.version = "1.0.5"
s.version = "1.0.6"
s.summary = "WSProgressHUD is a beauful hud view for iPhone & iPad."

s.description = <<-DESC
Expand All @@ -34,7 +34,7 @@ Pod::Spec.new do |s|

s.author = { "袁仕崇" => "xiaochong2154@163.com" }
s.platform = :ios, "6.0"
s.source = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.5" }
s.source = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.6" }
s.source_files = "WSProgressHUD/*"
s.exclude_files = "Demo/Exclude"

Expand Down
1 change: 1 addition & 0 deletions WSProgressHUD/MMMaterialDesignSpinner.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FOUNDATION_EXPORT const unsigned char MMMaterialDesignSpinnerVersionString[];
/** Property indicating whether the view is currently animating. */
@property (nonatomic, readonly) BOOL isAnimating;

@property (nonatomic, strong) UIColor *spinnerColor;
/**
* Convenience function for starting & stopping animation with a boolean variable instead of explicit
* method calls.
Expand Down
7 changes: 6 additions & 1 deletion WSProgressHUD/MMMaterialDesignSpinner.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,17 @@ - (void)updatePath {
- (CAShapeLayer *)progressLayer {
if (!_progressLayer) {
_progressLayer = [CAShapeLayer layer];
_progressLayer.strokeColor = self.tintColor.CGColor;
_progressLayer.strokeColor = [UIColor blueColor].CGColor;
_progressLayer.fillColor = nil;
_progressLayer.lineWidth = 1.5f;
}
return _progressLayer;
}
- (void)setSpinnerColor:(UIColor *)spinnerColor
{
self.progressLayer.strokeColor = spinnerColor.CGColor;
}


- (BOOL)isAnimating {
return _isAnimating;
Expand Down
2 changes: 1 addition & 1 deletion WSProgressHUD/WSProgressHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ typedef NS_ENUM(NSInteger, WSProgressHUDMaskWithoutType) { //
};

typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
WSProgressHUDIndicatorMMSpinner,
WSProgressHUDIndicatorCustom,
WSProgressHUDIndicatorMMSpinner,
WSProgressHUDIndicatorSmallLight,
};

Expand Down
14 changes: 5 additions & 9 deletions WSProgressHUD/WSProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ @interface WSProgressHUD ()
static UIImage *WSProgressHUDSuccessImage;
static UIImage *WSProgressHUDErrorImage;

static CGFloat const WSProgressHUDIndicatorBig = 35;
static CGFloat const WSProgressHUDIndicatorBig = 31;
static CGFloat const WSProgressHUDIndicatorSmall = 20;

static CGFloat WSProgressHUDRingThickness = 2;
Expand Down Expand Up @@ -341,10 +341,10 @@ - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProg
self.ringLayer.strokeEnd = progress;
return;
}

objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN);
objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeProgress), OBJC_ASSOCIATION_ASSIGN);
objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN);

[self invalidateTimer];

[self setMaskEdgeWithType:self.maskType];
Expand Down Expand Up @@ -566,6 +566,7 @@ - (void)updateSubviewsPositionWithString: (NSString *)string
WSProgressHUDStringRect.origin.y = imageOffset;
[self startIndicatorAnimation:NO];
self.labelView.center = CGPointMake(hudCenterX , hudCenterY + 20);
self.labelView.textAlignment = NSTextAlignmentCenter;
self.imageView.center = CGPointMake(hudCenterX, 30);
} else {
self.labelView.text = string;
Expand Down Expand Up @@ -981,7 +982,7 @@ - (void)drawRect:(CGRect)rect
switch (self.maskType) {
case WSProgressHUDMaskTypeClear: {
CGContextRef context = UIGraphicsGetCurrentContext();
[[UIColor colorWithWhite:0 alpha:0.5] set];
[[UIColor clearColor] set];
CGRect bounds = self.bounds;
CGContextFillRect(context, bounds);
}break;
Expand Down Expand Up @@ -1154,11 +1155,6 @@ - (UIImageView *)imageView
if (!_imageView) {
_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
_imageView.hidden = YES;
if ([_imageView respondsToSelector:@selector(setTintColor:)]) {
[_imageView setTintColor:WSProgressHUDForeGroundColor];
} else {

}
}
return _imageView;
}
Expand All @@ -1180,7 +1176,7 @@ - (MMMaterialDesignSpinner *)spinnerView
if (!_spinnerView) {
_spinnerView = [[MMMaterialDesignSpinner alloc] initWithFrame:CGRectZero];
_spinnerView.bounds = CGRectMake(0, 0, 20, 20);
_spinnerView.tintColor = WSProgressHUDForeGroundColor;
[_spinnerView setSpinnerColor:[UIColor whiteColor]];
}
return _spinnerView;
}
Expand Down

0 comments on commit 5a7e4ea

Please sign in to comment.