Skip to content

Commit 17d8cfc

Browse files
author
YSC
committed
Fix iOS6 Crash when setTintColor
1 parent 2d45e97 commit 17d8cfc

File tree

13 files changed

+43
-25
lines changed

13 files changed

+43
-25
lines changed

Demo/WSProgressHUD/MMMaterialDesignSpinner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ FOUNDATION_EXPORT const unsigned char MMMaterialDesignSpinnerVersionString[];
3333
/** Property indicating whether the view is currently animating. */
3434
@property (nonatomic, readonly) BOOL isAnimating;
3535

36+
@property (nonatomic, strong) UIColor *spinnerColor;
3637
/**
3738
* Convenience function for starting & stopping animation with a boolean variable instead of explicit
3839
* method calls.

Demo/WSProgressHUD/MMMaterialDesignSpinner.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,17 @@ - (void)updatePath {
169169
- (CAShapeLayer *)progressLayer {
170170
if (!_progressLayer) {
171171
_progressLayer = [CAShapeLayer layer];
172-
_progressLayer.strokeColor = self.tintColor.CGColor;
172+
_progressLayer.strokeColor = [UIColor blueColor].CGColor;
173173
_progressLayer.fillColor = nil;
174174
_progressLayer.lineWidth = 1.5f;
175175
}
176176
return _progressLayer;
177177
}
178+
- (void)setSpinnerColor:(UIColor *)spinnerColor
179+
{
180+
self.progressLayer.strokeColor = spinnerColor.CGColor;
181+
}
182+
178183

179184
- (BOOL)isAnimating {
180185
return _isAnimating;
1.21 KB
Loading
1.02 KB
Loading

Demo/WSProgressHUD/WSProgressHUD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ typedef NS_ENUM(NSInteger, WSProgressHUDMaskWithoutType) { //
2323
};
2424

2525
typedef NS_ENUM(NSInteger, WSProgressHUDIndicatorStyle) {
26-
WSProgressHUDIndicatorMMSpinner,
2726
WSProgressHUDIndicatorCustom,
27+
WSProgressHUDIndicatorMMSpinner,
2828
WSProgressHUDIndicatorSmallLight,
2929
};
3030

Demo/WSProgressHUD/WSProgressHUD.m

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ @interface WSProgressHUD ()
6969
static UIImage *WSProgressHUDSuccessImage;
7070
static UIImage *WSProgressHUDErrorImage;
7171

72-
static CGFloat const WSProgressHUDIndicatorBig = 35;
72+
static CGFloat const WSProgressHUDIndicatorBig = 31;
7373
static CGFloat const WSProgressHUDIndicatorSmall = 20;
7474

7575
static CGFloat WSProgressHUDRingThickness = 2;
@@ -341,15 +341,14 @@ - (void)showProgress:(CGFloat)progress status:(NSString*)string maskType:(WSProg
341341
self.ringLayer.strokeEnd = progress;
342342
return;
343343
}
344-
345344
objc_setAssociatedObject(self, @selector(maskType), @(maskType), OBJC_ASSOCIATION_ASSIGN);
346345
objc_setAssociatedObject(self, @selector(hudType), @(WSProgressHUDTypeProgress), OBJC_ASSOCIATION_ASSIGN);
347346
objc_setAssociatedObject(self, @selector(withoutType), @(withoutType), OBJC_ASSOCIATION_ASSIGN);
347+
348348
[self invalidateTimer];
349349

350350
[self setMaskEdgeWithType:self.maskType];
351351

352-
353352
[self updateSubviewsPositionWithString:string];
354353

355354
[self showHudViewWithAnimation];
@@ -1156,11 +1155,6 @@ - (UIImageView *)imageView
11561155
if (!_imageView) {
11571156
_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
11581157
_imageView.hidden = YES;
1159-
if ([_imageView respondsToSelector:@selector(setTintColor:)]) {
1160-
[_imageView setTintColor:WSProgressHUDForeGroundColor];
1161-
} else {
1162-
1163-
}
11641158
}
11651159
return _imageView;
11661160
}
@@ -1182,7 +1176,7 @@ - (MMMaterialDesignSpinner *)spinnerView
11821176
if (!_spinnerView) {
11831177
_spinnerView = [[MMMaterialDesignSpinner alloc] initWithFrame:CGRectZero];
11841178
_spinnerView.bounds = CGRectMake(0, 0, 20, 20);
1185-
_spinnerView.tintColor = WSProgressHUDForeGroundColor;
1179+
[_spinnerView setSpinnerColor:[UIColor whiteColor]];
11861180
}
11871181
return _spinnerView;
11881182
}

Demo/WSProgressHUDDemo/ViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ - (IBAction)show:(id)sender {
4747
// [WSProgressHUD setProgressHUDIndicatorStyle:WSProgressHUDIndicatorCustom];
4848
[WSProgressHUD showWithMaskType:WSProgressHUDMaskTypeBlack];
4949

50-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
50+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
5151
[WSProgressHUD dismiss];
5252
});
5353
}

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ This is a beauful hud view for iPhone & iPad
1313
To Download the project. Run the WSProgressHUD.xcodeproj in the demo directory.
1414

1515
``` objc
16+
17+
[WSProgressHUD show];
18+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
19+
...
20+
21+
dispatch_async(dispatch_get_main_queue(), ^{
22+
...
23+
[WSProgressHUD dismiss];
24+
});
25+
});
26+
1627
//Show on the self.view
1728

1829
@implementation ViewController
@@ -75,7 +86,13 @@ it, simply add the following line to your Podfile:
7586
7687
```ruby
7788
pod "WSProgressHUD"
89+
7890
```
91+
## Manually
92+
93+
Drag the WSProgressHUD/Demo/WSProgressHUD folder into your project.
94+
Then take care that SVProgressHUD.bundle is added to Targets->Build Phases->Copy Bundle Resources.
95+
Add the QuartzCore framework to your project.
7996

8097
##Thanks
8198

WSProgressHUD.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "WSProgressHUD"
19-
s.version = "1.0.5"
19+
s.version = "1.0.6"
2020
s.summary = "WSProgressHUD is a beauful hud view for iPhone & iPad."
2121

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

3535
s.author = { "袁仕崇" => "[email protected]" }
3636
s.platform = :ios, "6.0"
37-
s.source = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.5" }
37+
s.source = { :git => "https://github.com/devSC/WSProgressHUD.git", :tag => "1.0.6" }
3838
s.source_files = "WSProgressHUD/*"
3939
s.exclude_files = "Demo/Exclude"
4040

WSProgressHUD/MMMaterialDesignSpinner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ FOUNDATION_EXPORT const unsigned char MMMaterialDesignSpinnerVersionString[];
3333
/** Property indicating whether the view is currently animating. */
3434
@property (nonatomic, readonly) BOOL isAnimating;
3535

36+
@property (nonatomic, strong) UIColor *spinnerColor;
3637
/**
3738
* Convenience function for starting & stopping animation with a boolean variable instead of explicit
3839
* method calls.

0 commit comments

Comments
 (0)