Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ca59b59b3 | |||
| 5a13d866b8 | |||
| 5927f8faaa | |||
| e6b7550d5e | |||
| d46c8a6279 | |||
| cee320a57d | |||
| 63b422fac8 | |||
| a2f4e8448d | |||
| 8d97ac8b71 | |||
| 8971d7493a | |||
| 93772f7a65 | |||
| 148a116c73 | |||
| 5c64775358 | |||
| bb382e58bc | |||
| 25348b780c | |||
| c89079d627 | |||
| 31fec485e0 | |||
| ab6ece6f29 | |||
| b6a9f52057 | |||
| 0020ab2eae | |||
| 645fcf238e | |||
| c92b4390e2 | |||
| 121ced54a8 | |||
| a0a1074379 | |||
| 5fa55e4125 | |||
| 894e60cfd9 | |||
| 2bcfe6fc5e | |||
| 9d6365c25b | |||
| 5b2371819a | |||
| 7b1a47024c | |||
| 71c237eec6 | |||
| 53a3c25f91 | |||
| 56f020ced6 | |||
| 6000d1de0f |
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// UIApplication+M13ProgressSuite.m
|
||||
// M13ProgressView
|
||||
//
|
||||
/*Copyright (c) 2013 Brandon McQuilkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**A UIApplication category that deals with app extensions.*/
|
||||
@interface UIApplication (M13ProgressSuite)
|
||||
|
||||
/**Returns YES in case of app extension.*/
|
||||
+ (BOOL)isM13AppExtension;
|
||||
/**Returns the sharedApplication in case of app and nil in case of app extension.*/
|
||||
+ (UIApplication *)safeM13SharedApplication;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// UIApplication+M13ProgressSuite.m
|
||||
// M13ProgressView
|
||||
//
|
||||
|
||||
#import "UIApplication+M13ProgressSuite.h"
|
||||
|
||||
@implementation UIApplication (M13ProgressSuite)
|
||||
|
||||
+ (BOOL)isM13AppExtension
|
||||
{
|
||||
return [[self class] safeM13SharedApplication] == nil;
|
||||
}
|
||||
|
||||
+ (UIApplication *)safeM13SharedApplication
|
||||
{
|
||||
UIApplication *safeSharedApplication = nil;
|
||||
|
||||
if ([UIApplication respondsToSelector:@selector(sharedApplication)]) {
|
||||
safeSharedApplication = [UIApplication performSelector:@selector(sharedApplication)];
|
||||
}
|
||||
if (!safeSharedApplication.delegate) {
|
||||
safeSharedApplication = nil;
|
||||
}
|
||||
|
||||
return safeSharedApplication;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -276,7 +276,7 @@
|
||||
if (!_indeterminate) {
|
||||
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
|
||||
formatter.numberStyle = NSNumberFormatterPercentStyle;
|
||||
return [NSString stringWithFormat:@"\n%@",[formatter stringFromNumber:[NSNumber numberWithFloat:_progress]]];
|
||||
return [NSString stringWithFormat:@"\n%@",[formatter stringFromNumber:[NSNumber numberWithFloat:(float)_progress]]];
|
||||
} else {
|
||||
return @"\n??%";
|
||||
}
|
||||
|
||||
@@ -83,6 +83,9 @@ typedef enum {
|
||||
@property (nonatomic, assign) CGSize progressViewSize;
|
||||
/**The origin of the show/hide animation. show: will animate from this point, and hide: will animate to this point.*/
|
||||
@property (nonatomic, assign) CGPoint animationPoint;
|
||||
/**If true, animation doesn't come from animation point, but frame background view position
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL animationCentered;
|
||||
|
||||
/**@name Properties*/
|
||||
/**The durations of animations in seconds.*/
|
||||
|
||||
@@ -286,6 +286,7 @@
|
||||
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated
|
||||
{
|
||||
[_progressView setProgress:progress animated:animated];
|
||||
self.progress = progress;
|
||||
}
|
||||
|
||||
- (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
|
||||
@@ -301,7 +302,7 @@
|
||||
[self setNeedsDisplay];
|
||||
|
||||
onScreen = YES;
|
||||
|
||||
|
||||
//Animate the HUD on screen
|
||||
CABasicAnimation *fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
|
||||
fadeAnimation.duration = _animationDuration;
|
||||
@@ -320,7 +321,16 @@
|
||||
|
||||
CABasicAnimation *positionAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
|
||||
positionAnimation.duration = _animationDuration;
|
||||
positionAnimation.fromValue = [NSValue valueWithCGPoint:_animationPoint];
|
||||
|
||||
if (_animationCentered)
|
||||
{
|
||||
positionAnimation.fromValue = [NSValue valueWithCGPoint:backgroundView.layer.position];
|
||||
}
|
||||
else
|
||||
{
|
||||
positionAnimation.fromValue = [NSValue valueWithCGPoint:_animationPoint];
|
||||
}
|
||||
|
||||
positionAnimation.toValue = [NSValue valueWithCGPoint:backgroundView.layer.position];
|
||||
positionAnimation.removedOnCompletion = YES;
|
||||
|
||||
@@ -341,7 +351,7 @@
|
||||
fadeAnimation.fromValue = [NSNumber numberWithFloat:1.0];
|
||||
fadeAnimation.toValue = [NSNumber numberWithFloat:0.0];
|
||||
fadeAnimation.removedOnCompletion = YES;
|
||||
|
||||
|
||||
[self.layer addAnimation:fadeAnimation forKey:@"fadeAnimation"];
|
||||
self.layer.opacity = 0.0;
|
||||
|
||||
@@ -349,11 +359,24 @@
|
||||
scaleAnimation.fromValue = [NSNumber numberWithFloat:1.0];
|
||||
scaleAnimation.toValue = [NSNumber numberWithFloat:0.0];
|
||||
scaleAnimation.removedOnCompletion = YES;
|
||||
|
||||
|
||||
CABasicAnimation *frameAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
|
||||
frameAnimation.fromValue = [NSValue valueWithCGPoint:backgroundView.layer.position];
|
||||
frameAnimation.toValue = [NSValue valueWithCGPoint:_animationPoint];
|
||||
|
||||
if (_animationCentered)
|
||||
{
|
||||
frameAnimation.toValue = [NSValue valueWithCGPoint:backgroundView.layer.position];
|
||||
}
|
||||
else
|
||||
{
|
||||
frameAnimation.toValue = [NSValue valueWithCGPoint:_animationPoint];
|
||||
}
|
||||
|
||||
frameAnimation.removedOnCompletion = YES;
|
||||
|
||||
if (!_animationCentered)
|
||||
{
|
||||
backgroundView.layer.position = _animationPoint;
|
||||
}
|
||||
backgroundView.layer.position = _animationPoint;
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
@@ -385,7 +408,7 @@
|
||||
|
||||
- (void)deviceOrientationDidChange:(NSNotification *)notification {
|
||||
UIDeviceOrientation deviceOrientation = [notification.object orientation];
|
||||
|
||||
|
||||
if (_shouldAutorotate && UIDeviceOrientationIsValidInterfaceOrientation(deviceOrientation)) {
|
||||
if (UIDeviceOrientationIsPortrait(deviceOrientation)) {
|
||||
if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown) {
|
||||
@@ -534,7 +557,7 @@
|
||||
}
|
||||
|
||||
backgroundRect.origin.x = (self.bounds.size.width / 2.0) - (backgroundRect.size.width / 2.0);
|
||||
backgroundRect.origin.y = (self.bounds.size.height / 2.0) - (_minimumSize.height / 2.0);
|
||||
backgroundRect.origin.y = (self.bounds.size.height / 2.0) - (_minimumSize.height / 2.0);
|
||||
|
||||
//There is no status label text, center the progress view
|
||||
progressRect.origin.x = (backgroundRect.size.width / 2.0) - (progressRect.size.width / 2.0);
|
||||
@@ -554,19 +577,19 @@
|
||||
if (onScreen) {
|
||||
//Set the frame of the background and its subviews
|
||||
[UIView animateWithDuration:_animationDuration animations:^{
|
||||
backgroundView.frame = CGRectIntegral(backgroundRect);
|
||||
_progressView.frame = CGRectIntegral(progressRect);
|
||||
backgroundView.transform = CGAffineTransformMakeRotation([self angleForDeviceOrientation]);
|
||||
self->backgroundView.frame = CGRectIntegral(backgroundRect);
|
||||
self.progressView.frame = CGRectIntegral(progressRect);
|
||||
self->backgroundView.transform = CGAffineTransformMakeRotation([self angleForDeviceOrientation]);
|
||||
//Fade the label
|
||||
statusLabel.alpha = 0.0;
|
||||
self->statusLabel.alpha = 0.0;
|
||||
} completion:^(BOOL finished) {
|
||||
if (finished) {
|
||||
//Set the label frame
|
||||
statusLabel.frame = CGRectIntegral(statusRect);
|
||||
statusLabel.text = optimalStatusString;
|
||||
[UIView animateWithDuration:_animationDuration animations:^{
|
||||
self->statusLabel.frame = CGRectIntegral(statusRect);
|
||||
self->statusLabel.text = self->optimalStatusString;
|
||||
[UIView animateWithDuration:self.animationDuration animations:^{
|
||||
//Show the label
|
||||
statusLabel.alpha = 1.0;
|
||||
self->statusLabel.alpha = 1.0;
|
||||
}];
|
||||
}
|
||||
}];
|
||||
@@ -608,17 +631,17 @@
|
||||
for (NSString *rect in sizesArray) {
|
||||
CGRect theRect = CGRectFromString(rect);
|
||||
//Sum the widths to calculate the mean width
|
||||
standardDeviation += exp2f(theRect.size.width - meanWidth);
|
||||
standardDeviation += exp2f((float)theRect.size.width - meanWidth);
|
||||
}
|
||||
standardDeviation = sqrtf(standardDeviation / wordsArray.count);
|
||||
//Correct the mean width if it is below the minimum size
|
||||
if (meanWidth < _minimumSize.width) {
|
||||
meanWidth = _minimumSize.width;
|
||||
if (meanWidth < self.minimumSize.width) {
|
||||
meanWidth = (float)self.minimumSize.width;
|
||||
}
|
||||
|
||||
//Now calculate where to put line breaks. Lines can exceed the minimum width, but cannot exceed the minimum width plus the standard deviation. Single words can excced these limits.
|
||||
NSMutableString *correctedString = [[NSMutableString alloc] initWithString:wordsArray[0]];
|
||||
float lineSize = CGRectFromString(sizesArray[0]).size.width;
|
||||
float lineSize = (float)CGRectFromString(sizesArray[0]).size.width;
|
||||
for (int i = 1; i < wordsArray.count; i++) {
|
||||
NSString *word = wordsArray[i];
|
||||
CGRect wordRect = CGRectFromString(sizesArray[i]);
|
||||
@@ -674,6 +697,11 @@
|
||||
//Create the gradient as an image, and then set it as the color of the mask view.
|
||||
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, [UIScreen mainScreen].scale);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Create the gradient
|
||||
size_t locationsCount = 2;
|
||||
CGFloat locations[2] = {0.0f, 1.0f};
|
||||
@@ -683,7 +711,7 @@
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
//Draw the gradient
|
||||
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0);
|
||||
float radius = MIN(self.bounds.size.width , self.bounds.size.height) ;
|
||||
float radius = (float)MIN(self.bounds.size.width , self.bounds.size.height) ;
|
||||
CGContextDrawRadialGradient (context, gradient, center, 0, center, radius, kCGGradientDrawsAfterEndLocation);
|
||||
CGGradientRelease(gradient);
|
||||
//Get the gradient image
|
||||
@@ -691,6 +719,7 @@
|
||||
UIGraphicsEndImageContext();
|
||||
//Set the background
|
||||
maskView.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
|
||||
} else if (_maskType == M13ProgressHUDMaskTypeIOS7Blur) {
|
||||
// do nothing; we don't want to take a snapshot of the background for blurring now, no idea what the background is
|
||||
}
|
||||
@@ -698,45 +727,45 @@
|
||||
|
||||
- (void)redrawBlurs
|
||||
{
|
||||
if (_maskType == M13ProgressHUDMaskTypeIOS7Blur) {
|
||||
//Get the snapshot of the mask
|
||||
__block UIImage *image = [self snapshotForBlurredBackgroundInView:maskView];
|
||||
if (image != nil) {
|
||||
//Apply the filters to blur the image
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
image = [image applyLightEffect];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Fade on content's change, if there was already an image.
|
||||
CATransition *transition = [CATransition new];
|
||||
transition.duration = 0.3;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionFade;
|
||||
[maskView.layer addAnimation:transition forKey:nil];
|
||||
maskView.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
});
|
||||
if (_maskType == M13ProgressHUDMaskTypeIOS7Blur) {
|
||||
//Get the snapshot of the mask
|
||||
__block UIImage *image = [self snapshotForBlurredBackgroundInView:maskView];
|
||||
if (image != nil) {
|
||||
//Apply the filters to blur the image
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
image = [image applyLightEffect];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Fade on content's change, if there was already an image.
|
||||
CATransition *transition = [CATransition new];
|
||||
transition.duration = 0.3;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionFade;
|
||||
[self->maskView.layer addAnimation:transition forKey:nil];
|
||||
self->maskView.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_applyBlurToBackground) {
|
||||
//Get the snapshot of the mask
|
||||
__block UIImage *image = [self snapshotForBlurredBackgroundInView:backgroundView];
|
||||
if (image != nil) {
|
||||
//Apply the filters to blur the image
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
//image = [image applyLightEffect];
|
||||
image = [image applyLightEffect];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Fade on content's change, if there was already an image.
|
||||
CATransition *transition = [CATransition new];
|
||||
transition.duration = 0.3;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionFade;
|
||||
[backgroundView.layer addAnimation:transition forKey:nil];
|
||||
backgroundView.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
});
|
||||
}
|
||||
if (_applyBlurToBackground) {
|
||||
//Get the snapshot of the mask
|
||||
__block UIImage *image = [self snapshotForBlurredBackgroundInView:backgroundView];
|
||||
if (image != nil) {
|
||||
//Apply the filters to blur the image
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
//image = [image applyLightEffect];
|
||||
image = [image applyLightEffect];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Fade on content's change, if there was already an image.
|
||||
CATransition *transition = [CATransition new];
|
||||
transition.duration = 0.3;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionFade;
|
||||
[self->backgroundView.layer addAnimation:transition forKey:nil];
|
||||
self->backgroundView.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)snapshotForBlurredBackgroundInView:(UIView *)view
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
// ... if d is odd, use three box-blurs of size 'd', centered on the output pixel.
|
||||
//
|
||||
CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale];
|
||||
unsigned int radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5);
|
||||
unsigned int radius = (int)floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5);
|
||||
if (radius % 2 != 1) {
|
||||
radius += 1; // force radius to be odd so that the three box-blur methodology works.
|
||||
}
|
||||
@@ -221,7 +221,7 @@
|
||||
NSUInteger matrixSize = sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]);
|
||||
int16_t saturationMatrix[matrixSize];
|
||||
for (NSUInteger i = 0; i < matrixSize; ++i) {
|
||||
saturationMatrix[i] = (int16_t)roundf(floatingPointSaturationMatrix[i] * divisor);
|
||||
saturationMatrix[i] = (int16_t)roundf((float)floatingPointSaturationMatrix[i] * divisor);
|
||||
}
|
||||
if (hasBlur) {
|
||||
vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags);
|
||||
|
||||
@@ -50,5 +50,11 @@
|
||||
@param secondaryColor The color to set.
|
||||
*/
|
||||
- (void)setSecondaryColor:(UIColor *)secondaryColor;
|
||||
/**
|
||||
The background color of the progress bar, if nil, the background color will be the clearColor.
|
||||
|
||||
@param background The color to set.
|
||||
*/
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor;
|
||||
|
||||
@end
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
#import "UINavigationController+M13ProgressViewBar.h"
|
||||
#import "UIApplication+M13ProgressSuite.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
//Keys to set properties since one cannot define properties in a category.
|
||||
@@ -19,6 +20,8 @@ static char indeterminateLayerKey;
|
||||
static char isShowingProgressKey;
|
||||
static char primaryColorKey;
|
||||
static char secondaryColorKey;
|
||||
static char backgroundColorKey;
|
||||
static char backgroundViewKey;
|
||||
|
||||
@implementation UINavigationController (M13ProgressViewBar)
|
||||
|
||||
@@ -90,8 +93,8 @@ static char secondaryColorKey;
|
||||
- (void)finishProgress
|
||||
{
|
||||
UIView *progressView = [self getProgressView];
|
||||
|
||||
if (progressView) {
|
||||
UIView *backgroundView = [self getBackgroundView];
|
||||
if (progressView && backgroundView) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[UIView animateWithDuration:0.1 animations:^{
|
||||
CGRect progressFrame = progressView.frame;
|
||||
@@ -100,8 +103,11 @@ static char secondaryColorKey;
|
||||
} completion:^(BOOL finished) {
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
progressView.alpha = 0;
|
||||
backgroundView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[progressView removeFromSuperview];
|
||||
[backgroundView removeFromSuperview];
|
||||
backgroundView.alpha = 1;
|
||||
progressView.alpha = 1;
|
||||
[self setTitle:nil];
|
||||
[self setIsShowingProgressBar:NO];
|
||||
@@ -114,14 +120,18 @@ static char secondaryColorKey;
|
||||
- (void)cancelProgress
|
||||
{
|
||||
UIView *progressView = [self getProgressView];
|
||||
|
||||
if (progressView) {
|
||||
UIView *backgroundView = [self getBackgroundView];
|
||||
|
||||
if (progressView && backgroundView) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
progressView.alpha = 0;
|
||||
backgroundView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[progressView removeFromSuperview];
|
||||
[backgroundView removeFromSuperview];
|
||||
progressView.alpha = 1;
|
||||
backgroundView.alpha = 1;
|
||||
[self setTitle:nil];
|
||||
[self setIsShowingProgressBar:NO];
|
||||
}];
|
||||
@@ -129,14 +139,35 @@ static char secondaryColorKey;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Orientation
|
||||
|
||||
- (UIInterfaceOrientation)currentDeviceOrientation
|
||||
{
|
||||
UIInterfaceOrientation orientation;
|
||||
|
||||
if ([UIApplication isM13AppExtension]) {
|
||||
if ([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height) {
|
||||
orientation = UIInterfaceOrientationPortrait;
|
||||
} else {
|
||||
orientation = UIInterfaceOrientationLandscapeLeft;
|
||||
}
|
||||
} else {
|
||||
orientation = [UIApplication safeM13SharedApplication].statusBarOrientation;
|
||||
}
|
||||
|
||||
return orientation;
|
||||
}
|
||||
|
||||
#pragma mark Drawing
|
||||
|
||||
- (void)showProgress
|
||||
{
|
||||
UIView *progressView = [self getProgressView];
|
||||
UIView *backgroundView = [self getBackgroundView];
|
||||
|
||||
[UIView animateWithDuration:.1 animations:^{
|
||||
progressView.alpha = 1;
|
||||
backgroundView.alpha = 1;
|
||||
}];
|
||||
|
||||
[self setIsShowingProgressBar:YES];
|
||||
@@ -144,7 +175,7 @@ static char secondaryColorKey;
|
||||
|
||||
- (void)updateProgress
|
||||
{
|
||||
[self updateProgressWithInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation];
|
||||
[self updateProgressWithInterfaceOrientation:[self currentDeviceOrientation]];
|
||||
}
|
||||
|
||||
- (void)updateProgressWithInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
@@ -154,14 +185,31 @@ static char secondaryColorKey;
|
||||
if(!progressView)
|
||||
{
|
||||
progressView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 2.5)];
|
||||
progressView.backgroundColor = self.navigationBar.tintColor;
|
||||
if ([self getPrimaryColor]) {
|
||||
progressView.backgroundColor = [self getPrimaryColor];
|
||||
}
|
||||
progressView.clipsToBounds = YES;
|
||||
[self setProgressView:progressView];
|
||||
}
|
||||
|
||||
if ([self getPrimaryColor]) {
|
||||
progressView.backgroundColor = [self getPrimaryColor];
|
||||
} else {
|
||||
progressView.backgroundColor = self.navigationBar.tintColor;
|
||||
}
|
||||
|
||||
//Create background view if it doesn't exist
|
||||
UIView *backgroundView = [self getBackgroundView];
|
||||
if (!backgroundView)
|
||||
{
|
||||
backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 2.5)];
|
||||
backgroundView.clipsToBounds = YES;
|
||||
[self setBackgroundView:backgroundView];
|
||||
}
|
||||
|
||||
if ([self getBackgroundColor]) {
|
||||
backgroundView.backgroundColor = [self getBackgroundColor];
|
||||
} else {
|
||||
backgroundView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
//Calculate the frame of the navigation bar, based off the orientation.
|
||||
UIView *topView = self.topViewController.view;
|
||||
CGSize screenSize;
|
||||
@@ -189,20 +237,21 @@ static char secondaryColorKey;
|
||||
|
||||
//Check if the progress view is in its superview and if we are showing the bar.
|
||||
if (progressView.superview == nil && [self isShowingProgressBar]) {
|
||||
[self.navigationBar addSubview:backgroundView];
|
||||
[self.navigationBar addSubview:progressView];
|
||||
}
|
||||
|
||||
//Layout
|
||||
if (![self getIndeterminate]) {
|
||||
//Calculate the width of the progress view;
|
||||
float progressWidth = width * [self getProgress];
|
||||
float progressWidth = (float)width * (float)[self getProgress];
|
||||
//Set the frame of the progress view
|
||||
progressView.frame = CGRectMake(0, height - 2.5, progressWidth, 2.5);
|
||||
} else {
|
||||
//Calculate the width of the progress view
|
||||
progressView.frame = CGRectMake(0, height - 2.5, width, 2.5);
|
||||
}
|
||||
|
||||
backgroundView.frame = CGRectMake(0, height - 2.5, width, 2.5);
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
@@ -213,7 +262,7 @@ static char secondaryColorKey;
|
||||
|
||||
- (void)drawIndeterminate
|
||||
{
|
||||
[self drawIndeterminateWithInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation];
|
||||
[self drawIndeterminateWithInterfaceOrientation:[self currentDeviceOrientation]];
|
||||
}
|
||||
|
||||
- (void)drawIndeterminateWithInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
@@ -230,20 +279,13 @@ static char secondaryColorKey;
|
||||
//Calculate the frame of the navigation bar, based off the orientation.
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
CGFloat width = 0.0;
|
||||
CGFloat height = 0.0;
|
||||
//Calculate the width of the screen
|
||||
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
|
||||
//Use the maximum value
|
||||
width = MAX(screenSize.width, screenSize.height);
|
||||
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
|
||||
height = 32.0; //Hate hardcoding values, but autolayout doesn't work, and cant retreive the new height until after the animation completes.
|
||||
} else {
|
||||
height = 44.0; //Hate hardcoding values, but autolayout doesn't work, and cant retreive the new height until after the animation completes.
|
||||
}
|
||||
} else {
|
||||
//Use the minimum value
|
||||
width = MIN(screenSize.width, screenSize.height);
|
||||
height = 44.0; //Hate hardcoding values, but autolayout doesn't work, and cant retreive the new height until after the animation completes.
|
||||
}
|
||||
|
||||
//Create the pattern image
|
||||
@@ -348,7 +390,7 @@ static char secondaryColorKey;
|
||||
|
||||
- (void)setAnimationFromValue:(CGFloat)animationFromValue
|
||||
{
|
||||
objc_setAssociatedObject(self, &animationFromKey, [NSNumber numberWithFloat:animationFromValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(self, &animationFromKey, [NSNumber numberWithFloat:(float)animationFromValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (CGFloat)getAnimationFromValue
|
||||
@@ -359,7 +401,7 @@ static char secondaryColorKey;
|
||||
|
||||
- (void)setAnimationToValue:(CGFloat)animationToValue
|
||||
{
|
||||
objc_setAssociatedObject(self, &animationToKey, [NSNumber numberWithFloat:animationToValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(self, &animationToKey, [NSNumber numberWithFloat:(float)animationToValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (CGFloat)getAnimationToValue
|
||||
@@ -370,7 +412,7 @@ static char secondaryColorKey;
|
||||
|
||||
- (void)setAnimationStartTime:(NSTimeInterval)animationStartTime
|
||||
{
|
||||
objc_setAssociatedObject(self, &animationStartTimeKey, [NSNumber numberWithFloat:animationStartTime], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(self, &animationStartTimeKey, [NSNumber numberWithFloat:(float)animationStartTime], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (NSTimeInterval)getAnimationStartTime
|
||||
@@ -386,7 +428,7 @@ static char secondaryColorKey;
|
||||
} else if (progress < 0.0) {
|
||||
progress = 0.0;
|
||||
}
|
||||
objc_setAssociatedObject(self, &progressKey, [NSNumber numberWithFloat:progress], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(self, &progressKey, [NSNumber numberWithFloat:(float)progress], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
//Draw the update
|
||||
if ([NSThread isMainThread]) {
|
||||
[self updateProgress];
|
||||
@@ -424,6 +466,17 @@ static char secondaryColorKey;
|
||||
return objc_getAssociatedObject(self, &progressViewKey);
|
||||
}
|
||||
|
||||
- (void)setBackgroundView:(UIView *)view
|
||||
{
|
||||
objc_setAssociatedObject(self, &backgroundViewKey, view, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (UIView *)getBackgroundView
|
||||
{
|
||||
return objc_getAssociatedObject(self, &backgroundViewKey);
|
||||
}
|
||||
|
||||
|
||||
- (void)setIndeterminate:(BOOL)indeterminate
|
||||
{
|
||||
objc_setAssociatedObject(self, &indeterminateKey, [NSNumber numberWithBool:indeterminate], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
@@ -475,4 +528,15 @@ static char secondaryColorKey;
|
||||
return objc_getAssociatedObject(self, &secondaryColorKey);
|
||||
}
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor
|
||||
{
|
||||
objc_setAssociatedObject(self, &backgroundColorKey, backgroundColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
[self setIndeterminate:[self getIndeterminate]];
|
||||
}
|
||||
|
||||
- (UIColor *)getBackgroundColor
|
||||
{
|
||||
return objc_getAssociatedObject(self, &backgroundColorKey);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -229,18 +229,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -250,7 +250,7 @@
|
||||
{
|
||||
if (action == M13ProgressViewActionNone && _currentAction != M13ProgressViewActionNone) {
|
||||
_currentAction = action;
|
||||
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
|
||||
_percentageLabel.string = [self.percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
|
||||
[self setNeedsDisplay];
|
||||
[CATransaction begin];
|
||||
CABasicAnimation *barAnimation = [self barColorAnimation];
|
||||
@@ -373,7 +373,7 @@
|
||||
//Remove all animations
|
||||
[_indeterminateLayer removeAnimationForKey:@"position"];
|
||||
//Reset progress text
|
||||
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
|
||||
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@
|
||||
_percentageLabel.string = @"✕";
|
||||
} else if (_currentAction == M13ProgressViewActionNone) {
|
||||
if (!self.indeterminate) {
|
||||
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
|
||||
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
|
||||
} else {
|
||||
_percentageLabel.string = @"∞";
|
||||
}
|
||||
|
||||
@@ -202,18 +202,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
|
||||
@@ -125,18 +125,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -186,7 +186,7 @@
|
||||
//Calculate the current value
|
||||
CGFloat value = startValue + ((endValue - startValue) * self.progress);
|
||||
//Set the value
|
||||
[filter setValue:[NSNumber numberWithFloat:value] forKey:parameterKey];
|
||||
[filter setValue:[NSNumber numberWithFloat:(float)value] forKey:parameterKey];
|
||||
}
|
||||
//Set the input image
|
||||
[filter setValue:image forKey:kCIInputImageKey];
|
||||
|
||||
@@ -134,18 +134,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -187,15 +187,15 @@
|
||||
- (UIImage *)createImageForCurrentProgress
|
||||
{
|
||||
const int ALPHA = 0;
|
||||
const int RED = 1;
|
||||
const int RED = 3;
|
||||
const int GREEN = 2;
|
||||
const int BLUE = 3;
|
||||
|
||||
const int BLUE = 1;
|
||||
|
||||
//Create image rectangle with current image width/height
|
||||
CGRect imageRect = CGRectMake(0, 0, _progressImage.size.width * _progressImage.scale, _progressImage.size.height * _progressImage.scale);
|
||||
|
||||
int width = imageRect.size.width;
|
||||
int height = imageRect.size.height;
|
||||
int width = (int)imageRect.size.width;
|
||||
int height = (int)imageRect.size.height;
|
||||
|
||||
//The pixels will be painted to this array
|
||||
uint32_t *pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));
|
||||
@@ -218,13 +218,13 @@
|
||||
int yTo = height;
|
||||
|
||||
if (_progressDirection == M13ProgressViewImageProgressDirectionBottomToTop) {
|
||||
yTo = height * (1 - self.progress);
|
||||
yTo = (int)(height * (1 - self.progress));
|
||||
} else if (_progressDirection == M13ProgressViewImageProgressDirectionTopToBottom) {
|
||||
yFrom = height * self.progress;
|
||||
yFrom = (int)(height * self.progress);
|
||||
} else if (_progressDirection == M13ProgressViewImageProgressDirectionLeftToRight) {
|
||||
xFrom = width * self.progress;
|
||||
xFrom = (int)(width * self.progress);
|
||||
} else if (_progressDirection == M13ProgressViewImageProgressDirectionRightToLeft) {
|
||||
xTo = width * (1 - self.progress);
|
||||
xTo = (int)(width * (1 - self.progress));
|
||||
}
|
||||
|
||||
for (int x = xFrom; x < xTo; x++) {
|
||||
@@ -234,7 +234,7 @@
|
||||
//Convert
|
||||
if (_drawGreyscaleBackground) {
|
||||
//Convert to grayscale using luma coding: http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
||||
uint32_t gray = 0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE];
|
||||
uint8_t gray = (uint8_t)(0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE]);
|
||||
// set the pixels to gray
|
||||
rgbaPixel[RED] = gray;
|
||||
rgbaPixel[GREEN] = gray;
|
||||
|
||||
@@ -193,18 +193,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -256,10 +256,10 @@
|
||||
//Setup
|
||||
CGRect pointRect = CGRectZero;
|
||||
int index = -1;
|
||||
int indexToFillTo = _progressView.numberOfGridPoints.x * _progressView.numberOfGridPoints.y * _progressView.progress;
|
||||
int indexToFillTo = (int)(_progressView.numberOfGridPoints.x * _progressView.numberOfGridPoints.y * _progressView.progress);
|
||||
|
||||
//Draw
|
||||
for (int y = _progressView.numberOfGridPoints.y - 1; y >= 0; y--) {
|
||||
for (int y = (int)_progressView.numberOfGridPoints.y - 1; y >= 0; y--) {
|
||||
for (int x = 0; x < _progressView.numberOfGridPoints.x; x++) {
|
||||
|
||||
index += 1;
|
||||
|
||||
@@ -261,18 +261,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self showProgress];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self showProgress];
|
||||
|
||||
});
|
||||
@@ -281,7 +281,7 @@
|
||||
- (void)showProgress
|
||||
{
|
||||
static int pastIndexToHighlightTo = 0;
|
||||
int indexToHighlightTo = ceilf(_numberOfDots * self.progress);
|
||||
int indexToHighlightTo = (int)ceilf(_numberOfDots * (float)self.progress);
|
||||
//Only perform the animation if necessary.
|
||||
if (pastIndexToHighlightTo != indexToHighlightTo) {
|
||||
for (int i = 0; i < _numberOfDots; i++) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
} else {
|
||||
NSMutableArray *pointsArray = [NSMutableArray array];
|
||||
for (int i = 0; i < _numberOfSides; i++) {
|
||||
CGPoint point = CGPointMake(_radius * cosf((2.0 * M_PI * (float)i) / (float)_numberOfSides), _radius * sinf((2.0 * M_PI * (float)i) / (float)_numberOfSides));
|
||||
CGPoint point = CGPointMake(_radius * cosf((2.0f * (float)M_PI * (float)i) / (float)_numberOfSides), (float)_radius * sinf((2.0f * (float)M_PI * (float)i) / (float)_numberOfSides));
|
||||
NSValue *value = [NSValue valueWithCGPoint:point];
|
||||
[pointsArray addObject:value];
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
//Set defaut sizes
|
||||
_backgroundRingWidthOverriden = NO;
|
||||
_backgroundRingWidth = fmaxf(self.bounds.size.width * .025, 1.0);
|
||||
_backgroundRingWidth = fmaxf((float)self.bounds.size.width * .025f, 1.0);
|
||||
|
||||
self.animationDuration = .3;
|
||||
|
||||
@@ -181,18 +181,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -230,9 +230,9 @@
|
||||
[CATransaction begin];
|
||||
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewPieHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
_currentAction = action;
|
||||
self.currentAction = action;
|
||||
[self drawIcon];
|
||||
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
|
||||
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
}
|
||||
@@ -254,9 +254,9 @@
|
||||
[CATransaction begin];
|
||||
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewPieHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
_currentAction = action;
|
||||
self.currentAction = action;
|
||||
[self drawIcon];
|
||||
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
|
||||
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
}
|
||||
@@ -272,7 +272,7 @@
|
||||
|
||||
//Create the rotation animation
|
||||
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
|
||||
rotationAnimation.duration = 1;
|
||||
rotationAnimation.cumulative = YES;
|
||||
rotationAnimation.repeatCount = HUGE_VALF;
|
||||
@@ -290,7 +290,7 @@
|
||||
[_indeterminateLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewPieHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
//Remove the rotation animation and reset the background
|
||||
[_backgroundLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self.backgroundLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self drawBackground];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
@@ -337,7 +337,7 @@
|
||||
|
||||
//Update line widths if not overriden
|
||||
if (!_backgroundRingWidthOverriden) {
|
||||
_backgroundRingWidth = fmaxf(self.frame.size.width * .025, 1.0);
|
||||
_backgroundRingWidth = fmaxf((float)self.frame.size.width * .025f, 1.0);
|
||||
}
|
||||
|
||||
//Redraw
|
||||
@@ -443,8 +443,8 @@
|
||||
- (void)drawBackground
|
||||
{
|
||||
//Create parameters to draw background
|
||||
float startAngle = - M_PI_2;
|
||||
float endAngle = startAngle + (2.0 * M_PI);
|
||||
float startAngle = - (float)M_PI_2;
|
||||
float endAngle = (float)(startAngle + (2.0 * M_PI));
|
||||
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
|
||||
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
|
||||
|
||||
@@ -461,8 +461,8 @@
|
||||
- (void)drawProgress
|
||||
{
|
||||
//Create parameters to draw progress
|
||||
float startAngle = - M_PI_2;
|
||||
float endAngle = startAngle + (2.0 * M_PI * self.progress);
|
||||
float startAngle = - (float)M_PI_2;
|
||||
float endAngle = (float)(startAngle + (2.0 * M_PI * self.progress));
|
||||
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
|
||||
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
|
||||
|
||||
@@ -492,8 +492,8 @@
|
||||
- (void)drawIndeterminate
|
||||
{
|
||||
//Create parameters to draw progress
|
||||
float startAngle = - M_PI_2;
|
||||
float endAngle = startAngle + (2.0 * M_PI * .2);
|
||||
float startAngle = - (float)M_PI_2;
|
||||
float endAngle = (float)(startAngle + (2.0 * M_PI * .2));
|
||||
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
|
||||
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
|
||||
|
||||
|
||||
@@ -168,18 +168,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -244,7 +244,7 @@
|
||||
|
||||
UIBezierPath *path;
|
||||
int i = 0;
|
||||
int indexOfLastFilledPath = ceilf(self.progress * (float)_numberOfRipples);
|
||||
int indexOfLastFilledPath = (int)ceilf((float)self.progress * (float)_numberOfRipples);
|
||||
while ((path = [enumerator nextObject])) {
|
||||
//Set the path's color
|
||||
if (!self.indeterminate) {
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
//Set defaut sizes
|
||||
_backgroundRingWidth = fmaxf(self.bounds.size.width * .025, 1.0);
|
||||
_backgroundRingWidth = fmaxf((float)self.bounds.size.width * .025f, 1.0);
|
||||
_progressRingWidth = 3 * _backgroundRingWidth;
|
||||
_progressRingWidthOverriden = NO;
|
||||
_backgroundRingWidthOverriden = NO;
|
||||
@@ -209,18 +209,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -250,9 +250,9 @@
|
||||
[CATransaction begin];
|
||||
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewRingHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
_currentAction = action;
|
||||
self.currentAction = action;
|
||||
[self drawIcon];
|
||||
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
|
||||
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
}
|
||||
@@ -270,9 +270,9 @@
|
||||
[CATransaction begin];
|
||||
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewRingHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
_currentAction = action;
|
||||
self.currentAction = action;
|
||||
[self drawIcon];
|
||||
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
|
||||
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
}
|
||||
@@ -288,7 +288,7 @@
|
||||
|
||||
//Create the rotation animation
|
||||
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
|
||||
rotationAnimation.duration = 1;
|
||||
rotationAnimation.cumulative = YES;
|
||||
rotationAnimation.repeatCount = HUGE_VALF;
|
||||
@@ -306,7 +306,7 @@
|
||||
[_percentageLabel.layer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
//Remove the rotation animation and reset the background
|
||||
[_backgroundLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self.backgroundLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self drawBackground];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
@@ -357,12 +357,15 @@
|
||||
|
||||
//Update line widths if not overriden
|
||||
if (!_backgroundRingWidthOverriden) {
|
||||
_backgroundRingWidth = fmaxf(self.frame.size.width * .025, 1.0);
|
||||
_backgroundRingWidth = fmaxf((float)self.frame.size.width * .025f, 1.0);
|
||||
}
|
||||
_backgroundLayer.lineWidth = _backgroundRingWidth;
|
||||
|
||||
if (!_progressRingWidthOverriden) {
|
||||
_progressRingWidth = _backgroundRingWidth * 3;
|
||||
}
|
||||
|
||||
_progressLayer.lineWidth = _progressRingWidth;
|
||||
|
||||
//Redraw
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
@@ -462,14 +465,14 @@
|
||||
- (void)drawBackground
|
||||
{
|
||||
//Create parameters to draw background
|
||||
float startAngle = - M_PI_2;
|
||||
float endAngle = startAngle + (2.0 * M_PI);
|
||||
float startAngle = - (float)M_PI_2;
|
||||
float endAngle = (float)(startAngle + (2.0 * M_PI));
|
||||
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
|
||||
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
|
||||
|
||||
//If indeterminate, recalculate the end angle
|
||||
if (self.indeterminate) {
|
||||
endAngle = .8 * endAngle;
|
||||
endAngle = .8f * endAngle;
|
||||
}
|
||||
|
||||
//Draw path
|
||||
@@ -485,8 +488,8 @@
|
||||
- (void)drawProgress
|
||||
{
|
||||
//Create parameters to draw progress
|
||||
float startAngle = - M_PI_2;
|
||||
float endAngle = startAngle + (2.0 * M_PI * self.progress);
|
||||
float startAngle = - (float)M_PI_2;
|
||||
float endAngle = (float)(startAngle + (2.0 * M_PI * self.progress));
|
||||
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
|
||||
CGFloat radius = (self.bounds.size.width - _progressRingWidth) / 2.0;
|
||||
|
||||
@@ -500,7 +503,7 @@
|
||||
[_progressLayer setPath:path.CGPath];
|
||||
|
||||
//Update label
|
||||
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
|
||||
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
|
||||
}
|
||||
|
||||
- (void)drawIcon
|
||||
|
||||
@@ -204,18 +204,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -228,7 +228,7 @@
|
||||
[self setNeedsDisplay];
|
||||
[CATransaction begin];
|
||||
for (int i = 0; i < _numberOfSegments; i++) {
|
||||
CAShapeLayer *layer = _segmentsLayer.sublayers[i];
|
||||
CAShapeLayer *layer = (CAShapeLayer *)_segmentsLayer.sublayers[i];
|
||||
CABasicAnimation *barAnimation = [self barColorAnimation];
|
||||
barAnimation.fromValue = (id)layer.fillColor;
|
||||
barAnimation.toValue = (id)[self colorForSegment:i].CGColor;
|
||||
@@ -240,7 +240,7 @@
|
||||
[self setNeedsDisplay];
|
||||
[CATransaction begin];
|
||||
for (int i = 0; i < _numberOfSegments; i++) {
|
||||
CAShapeLayer *layer = _segmentsLayer.sublayers[i];
|
||||
CAShapeLayer *layer = (CAShapeLayer *)_segmentsLayer.sublayers[i];
|
||||
CABasicAnimation *barAnimation = [self barColorAnimation];
|
||||
barAnimation.fromValue = (id)layer.fillColor;
|
||||
barAnimation.toValue = (id)_successColor.CGColor;
|
||||
@@ -252,7 +252,7 @@
|
||||
[self setNeedsDisplay];
|
||||
[CATransaction begin];
|
||||
for (int i = 0; i < _numberOfSegments; i++) {
|
||||
CAShapeLayer *layer = _segmentsLayer.sublayers[i];
|
||||
CAShapeLayer *layer = (CAShapeLayer *)_segmentsLayer.sublayers[i];
|
||||
CABasicAnimation *barAnimation = [self barColorAnimation];
|
||||
barAnimation.fromValue = (id)layer.fillColor;
|
||||
barAnimation.toValue = (id)_failureColor.CGColor;
|
||||
@@ -359,7 +359,7 @@
|
||||
|
||||
- (NSInteger)numberOfFullSegments
|
||||
{
|
||||
return (NSInteger)floorf(self.progress * _numberOfSegments);
|
||||
return (NSInteger)floorf((float)self.progress * (float)_numberOfSegments);
|
||||
}
|
||||
|
||||
- (UIColor *)colorForSegment:(NSUInteger)index
|
||||
@@ -393,7 +393,7 @@
|
||||
if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeRoundedRect) {
|
||||
cornerRadius = _cornerRadius;
|
||||
} else if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeCircle) {
|
||||
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? self.bounds.size.height / 2.0 : segmentWidth / 2.0);
|
||||
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? (float)self.bounds.size.height / 2.0f : (float)segmentWidth / 2.0f);
|
||||
}
|
||||
|
||||
//Iterate through all the segments that are full.
|
||||
@@ -450,7 +450,7 @@
|
||||
}
|
||||
|
||||
//Add segment to the proper layer, and color it
|
||||
CAShapeLayer *layer = _segmentsLayer.sublayers[i];
|
||||
CAShapeLayer *layer = (CAShapeLayer *)_segmentsLayer.sublayers[i];
|
||||
layer.path = path.CGPath;
|
||||
layer.fillColor = [self colorForSegment:i].CGColor;
|
||||
}
|
||||
@@ -470,7 +470,7 @@
|
||||
if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeRoundedRect) {
|
||||
cornerRadius = _cornerRadius;
|
||||
} else if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeCircle) {
|
||||
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? self.bounds.size.height / 2.0 : segmentWidth / 2.0);
|
||||
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? (float)self.bounds.size.height / 2.0f : (float)segmentWidth / 2.0f);
|
||||
}
|
||||
//What index will the segments be colored from.
|
||||
NSInteger numberOfSegmentsToBeColored = _numberOfSegments / 4;
|
||||
@@ -529,7 +529,7 @@
|
||||
}
|
||||
|
||||
//Add the segment to the proper path //Add segment to the proper layer, and color it
|
||||
CAShapeLayer *layer = _segmentsLayer.sublayers[i];
|
||||
CAShapeLayer *layer = (CAShapeLayer *)_segmentsLayer.sublayers[i];
|
||||
layer.path = path.CGPath;
|
||||
if (i >= indeterminateIndex && i < indeterminateIndex + numberOfSegmentsToBeColored) {
|
||||
layer.fillColor = ((UIColor *)segmentColorsPrimary[i]).CGColor;
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
//Set defaut sizes
|
||||
_progressRingWidth = fmaxf(self.bounds.size.width * .25, 1.0);
|
||||
_progressRingWidth = fmaxf((float)self.bounds.size.width * .25f, 1.0);
|
||||
_progressRingWidthOverriden = NO;
|
||||
_segmentSeparationAngleOverriden = NO;
|
||||
self.animationDuration = .3;
|
||||
@@ -233,18 +233,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
@@ -274,9 +274,9 @@
|
||||
[CATransaction begin];
|
||||
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewSegmentedRingHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
_currentAction = action;
|
||||
self.currentAction = action;
|
||||
[self drawIcon];
|
||||
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
|
||||
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
}
|
||||
@@ -294,9 +294,9 @@
|
||||
[CATransaction begin];
|
||||
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewSegmentedRingHideKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
_currentAction = action;
|
||||
self.currentAction = action;
|
||||
[self drawIcon];
|
||||
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
|
||||
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
|
||||
}];
|
||||
[CATransaction commit];
|
||||
}
|
||||
@@ -310,13 +310,13 @@
|
||||
|
||||
//Create the rotation animation
|
||||
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
|
||||
rotationAnimation.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
|
||||
rotationAnimation.duration = 5 * self.animationDuration;
|
||||
rotationAnimation.cumulative = YES;
|
||||
rotationAnimation.repeatCount = HUGE_VALF;
|
||||
|
||||
CABasicAnimation *rotationAnimationProgress = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
rotationAnimationProgress.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
|
||||
rotationAnimationProgress.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
|
||||
rotationAnimationProgress.duration = 5 * self.animationDuration;
|
||||
rotationAnimationProgress.cumulative = YES;
|
||||
rotationAnimationProgress.repeatCount = HUGE_VALF;
|
||||
@@ -333,8 +333,8 @@
|
||||
[_percentageLabel.layer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
|
||||
[CATransaction setCompletionBlock:^{
|
||||
//Remove the rotation animation and reset the background
|
||||
[_backgroundLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[_progressLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self.backgroundLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self.progressLayer removeAnimationForKey:@"rotationAnimation"];
|
||||
[self drawBackground];
|
||||
[self drawProgress];
|
||||
}];
|
||||
@@ -384,7 +384,7 @@
|
||||
|
||||
//Update line widths if not overriden
|
||||
if (!_progressRingWidthOverriden) {
|
||||
_progressRingWidth = fmaxf(self.frame.size.width * .25, 1.0);
|
||||
_progressRingWidth = fmaxf((float)(self.frame.size.width * .25), 1.0);
|
||||
}
|
||||
|
||||
[self updateAngles];
|
||||
@@ -418,14 +418,14 @@
|
||||
//Calculate the outer ring angle for the progress segment.*/
|
||||
outerRingAngle = ((2.0 * M_PI) / (float)_numberOfSegments) - _segmentSeparationAngle;
|
||||
//Calculate the angle gap for the inner ring
|
||||
_segmentSeparationInnerAngle = 2.0 * asinf(((self.bounds.size.width / 2.0) * sinf(_segmentSeparationAngle / 2.0)) / ((self.bounds.size.width / 2.0) - _progressRingWidth));
|
||||
_segmentSeparationInnerAngle = 2.0f * asinf((float)((self.bounds.size.width / 2.0) * sinf((float)_segmentSeparationAngle / 2.0f)) / (((float)self.bounds.size.width / 2.0f) - (float)_progressRingWidth));
|
||||
//Calculate the inner ring angle for the progress segment.*/
|
||||
innerRingAngle = ((2.0 * M_PI) / (float)_numberOfSegments) - _segmentSeparationInnerAngle;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfFullSegments
|
||||
{
|
||||
return (NSInteger)floorf(self.progress * _numberOfSegments);
|
||||
return (NSInteger)floorf((float)(self.progress * _numberOfSegments));
|
||||
}
|
||||
|
||||
#pragma mark Drawing
|
||||
@@ -585,7 +585,7 @@
|
||||
CGPathRelease(pathRef);
|
||||
|
||||
//Update label
|
||||
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
|
||||
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
|
||||
}
|
||||
|
||||
- (void)drawIcon
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
- (void)setBorderWidth:(CGFloat)borderWidth
|
||||
{
|
||||
_borderWidth = borderWidth;
|
||||
_backgroundLayer.lineWidth = borderWidth;
|
||||
[self invalidateIntrinsicContentSize];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
@@ -235,18 +236,18 @@
|
||||
- (void)animateProgress:(CADisplayLink *)displayLink
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
|
||||
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
|
||||
if (dt >= 1.0) {
|
||||
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
|
||||
[self.displayLink invalidate];
|
||||
self.displayLink = nil;
|
||||
[super setProgress:_animationToValue animated:NO];
|
||||
[super setProgress:self.animationToValue animated:NO];
|
||||
[self setNeedsDisplay];
|
||||
return;
|
||||
}
|
||||
|
||||
//Set progress
|
||||
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
|
||||
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
|
||||
[self setNeedsDisplay];
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "M13ProgressSuite"
|
||||
s.version = "1.2.7"
|
||||
s.version = "1.2.9"
|
||||
s.summary = "A suite containing many tools to display progress information on iOS."
|
||||
|
||||
s.description = <<-DESC
|
||||
@@ -27,7 +27,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
s.platform = :ios, '7.0'
|
||||
|
||||
s.source = { :git => "https://github.com/Marxon13/M13ProgressSuite.git", :tag => "v1.2.7"}
|
||||
s.source = { :git => "https://github.com/Marxon13/M13ProgressSuite.git", :tag => "v1.2.9"}
|
||||
|
||||
s.source_files = 'Classes/*/*'
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
62BB86011C87300F0019306A /* UIApplication+M13ProgressSuite.m in Sources */ = {isa = PBXBuildFile; fileRef = 62BB86001C87300F0019306A /* UIApplication+M13ProgressSuite.m */; };
|
||||
CA2FAF9C1889907300BCAEF5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA2FAF9B1889907300BCAEF5 /* Foundation.framework */; };
|
||||
CA2FAF9E1889907300BCAEF5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA2FAF9D1889907300BCAEF5 /* CoreGraphics.framework */; };
|
||||
CA2FAFA01889907300BCAEF5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA2FAF9F1889907300BCAEF5 /* UIKit.framework */; };
|
||||
@@ -56,9 +57,9 @@
|
||||
CA412B0518D2638E00FCB7CC /* RadiativeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CA412B0418D2638E00FCB7CC /* RadiativeViewController.m */; };
|
||||
CA66890618CBEF9300827C48 /* MetroViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CA66890518CBEF9300827C48 /* MetroViewController.m */; };
|
||||
CA6F31C7190EBF11008D1E64 /* LetterpressViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CA6F31C6190EBF11008D1E64 /* LetterpressViewController.m */; };
|
||||
FB2A7BE11B793E5600FE4E4A /* M13ProgressSuiteFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = FB2A7BE01B793E5600FE4E4A /* M13ProgressSuiteFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FB2A7BF31B793E5600FE4E4A /* M13ProgressSuiteFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuiteFramework.framework */; };
|
||||
FB2A7BF41B793E5600FE4E4A /* M13ProgressSuiteFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuiteFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
FB2A7BE11B793E5600FE4E4A /* M13ProgressSuite.h in Headers */ = {isa = PBXBuildFile; fileRef = FB2A7BE01B793E5600FE4E4A /* M13ProgressSuite.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FB2A7BF31B793E5600FE4E4A /* M13ProgressSuite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuite.framework */; };
|
||||
FB2A7BF41B793E5600FE4E4A /* M13ProgressSuite.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuite.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
FB2A7BFC1B793E6B00FE4E4A /* M13ProgressView.h in Headers */ = {isa = PBXBuildFile; fileRef = CA2FAFE11889937800BCAEF5 /* M13ProgressView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
FB2A7BFD1B793E6B00FE4E4A /* M13ProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA2FAFE21889937800BCAEF5 /* M13ProgressView.m */; };
|
||||
FB2A7BFE1B793E6B00FE4E4A /* M13ProgressViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = CA2FAFE31889937800BCAEF5 /* M13ProgressViewBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -121,7 +122,7 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
FB2A7BF41B793E5600FE4E4A /* M13ProgressSuiteFramework.framework in Embed Frameworks */,
|
||||
FB2A7BF41B793E5600FE4E4A /* M13ProgressSuite.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -129,9 +130,11 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
62BB85FF1C87300F0019306A /* UIApplication+M13ProgressSuite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIApplication+M13ProgressSuite.h"; path = "Classes/Application/UIApplication+M13ProgressSuite.h"; sourceTree = "<group>"; };
|
||||
62BB86001C87300F0019306A /* UIApplication+M13ProgressSuite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIApplication+M13ProgressSuite.m"; path = "Classes/Application/UIApplication+M13ProgressSuite.m"; sourceTree = "<group>"; };
|
||||
CA1C945C18CCF59500B469BF /* M13ProgressViewMetroDotPolygon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = M13ProgressViewMetroDotPolygon.h; path = Classes/ProgressViews/M13ProgressViewMetroDotPolygon.h; sourceTree = "<group>"; };
|
||||
CA1C945D18CCF59500B469BF /* M13ProgressViewMetroDotPolygon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = M13ProgressViewMetroDotPolygon.m; path = Classes/ProgressViews/M13ProgressViewMetroDotPolygon.m; sourceTree = "<group>"; };
|
||||
CA2FAF981889907300BCAEF5 /* M13ProgressSuite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = M13ProgressSuite.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CA2FAF981889907300BCAEF5 /* M13ProgressSuiteDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = M13ProgressSuiteDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CA2FAF9B1889907300BCAEF5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
CA2FAF9D1889907300BCAEF5 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
CA2FAF9F1889907300BCAEF5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
@@ -220,9 +223,9 @@
|
||||
CA6F31C2190EA88D008D1E64 /* M13ProgressViewLetterpress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = M13ProgressViewLetterpress.m; path = Classes/ProgressViews/M13ProgressViewLetterpress.m; sourceTree = "<group>"; };
|
||||
CA6F31C5190EBF11008D1E64 /* LetterpressViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LetterpressViewController.h; sourceTree = "<group>"; };
|
||||
CA6F31C6190EBF11008D1E64 /* LetterpressViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LetterpressViewController.m; sourceTree = "<group>"; };
|
||||
FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuiteFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = M13ProgressSuiteFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = M13ProgressSuite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FB2A7BDF1B793E5600FE4E4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
FB2A7BE01B793E5600FE4E4A /* M13ProgressSuiteFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = M13ProgressSuiteFramework.h; sourceTree = "<group>"; };
|
||||
FB2A7BE01B793E5600FE4E4A /* M13ProgressSuite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = M13ProgressSuite.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -231,7 +234,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CA2FAF9E1889907300BCAEF5 /* CoreGraphics.framework in Frameworks */,
|
||||
FB2A7BF31B793E5600FE4E4A /* M13ProgressSuiteFramework.framework in Frameworks */,
|
||||
FB2A7BF31B793E5600FE4E4A /* M13ProgressSuite.framework in Frameworks */,
|
||||
CA2FB03E1889975A00BCAEF5 /* QuartzCore.framework in Frameworks */,
|
||||
CA2FB03C1889975400BCAEF5 /* CoreImage.framework in Frameworks */,
|
||||
CA2FB03A1889974600BCAEF5 /* Accelerate.framework in Frameworks */,
|
||||
@@ -260,6 +263,15 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
62BB85FE1C872FF50019306A /* M13ProgressApplication */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
62BB85FF1C87300F0019306A /* UIApplication+M13ProgressSuite.h */,
|
||||
62BB86001C87300F0019306A /* UIApplication+M13ProgressSuite.m */,
|
||||
);
|
||||
name = M13ProgressApplication;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA2FAF8F1889907300BCAEF5 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -276,9 +288,9 @@
|
||||
CA2FAF991889907300BCAEF5 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CA2FAF981889907300BCAEF5 /* M13ProgressSuite.app */,
|
||||
CA2FAF981889907300BCAEF5 /* M13ProgressSuiteDemo.app */,
|
||||
CA2FAFBC1889907300BCAEF5 /* M13ProgressSuiteTests.xctest */,
|
||||
FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuiteFramework.framework */,
|
||||
FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuite.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -347,6 +359,7 @@
|
||||
CA2FAFDF1889935700BCAEF5 /* HUD */,
|
||||
CA2FAFDB1889934300BCAEF5 /* Console */,
|
||||
CA2FAFD41889928200BCAEF5 /* M13ProgressNavigationController */,
|
||||
62BB85FE1C872FF50019306A /* M13ProgressApplication */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
@@ -570,7 +583,7 @@
|
||||
FB2A7BDD1B793E5600FE4E4A /* M13ProgressSuiteFramework */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FB2A7BE01B793E5600FE4E4A /* M13ProgressSuiteFramework.h */,
|
||||
FB2A7BE01B793E5600FE4E4A /* M13ProgressSuite.h */,
|
||||
FB2A7BDE1B793E5600FE4E4A /* Supporting Files */,
|
||||
);
|
||||
path = M13ProgressSuiteFramework;
|
||||
@@ -591,7 +604,7 @@
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FB2A7BE11B793E5600FE4E4A /* M13ProgressSuiteFramework.h in Headers */,
|
||||
FB2A7BE11B793E5600FE4E4A /* M13ProgressSuite.h in Headers */,
|
||||
FB2A7BFC1B793E6B00FE4E4A /* M13ProgressView.h in Headers */,
|
||||
FB2A7BFE1B793E6B00FE4E4A /* M13ProgressViewBar.h in Headers */,
|
||||
FB2A7C001B793E6B00FE4E4A /* M13ProgressViewBorderedBar.h in Headers */,
|
||||
@@ -616,9 +629,9 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
CA2FAF971889907300BCAEF5 /* M13ProgressSuite */ = {
|
||||
CA2FAF971889907300BCAEF5 /* M13ProgressSuiteDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = CA2FAFCD1889907300BCAEF5 /* Build configuration list for PBXNativeTarget "M13ProgressSuite" */;
|
||||
buildConfigurationList = CA2FAFCD1889907300BCAEF5 /* Build configuration list for PBXNativeTarget "M13ProgressSuiteDemo" */;
|
||||
buildPhases = (
|
||||
CA2FAF941889907300BCAEF5 /* Sources */,
|
||||
CA2FAF951889907300BCAEF5 /* Frameworks */,
|
||||
@@ -630,9 +643,9 @@
|
||||
dependencies = (
|
||||
FB2A7BF21B793E5600FE4E4A /* PBXTargetDependency */,
|
||||
);
|
||||
name = M13ProgressSuite;
|
||||
name = M13ProgressSuiteDemo;
|
||||
productName = M13ProgressSuite;
|
||||
productReference = CA2FAF981889907300BCAEF5 /* M13ProgressSuite.app */;
|
||||
productReference = CA2FAF981889907300BCAEF5 /* M13ProgressSuiteDemo.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
CA2FAFBB1889907300BCAEF5 /* M13ProgressSuiteTests */ = {
|
||||
@@ -668,7 +681,7 @@
|
||||
);
|
||||
name = M13ProgressSuiteFramework;
|
||||
productName = M13ProgressSuiteFramework;
|
||||
productReference = FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuiteFramework.framework */;
|
||||
productReference = FB2A7BDC1B793E5600FE4E4A /* M13ProgressSuite.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
@@ -677,7 +690,7 @@
|
||||
CA2FAF901889907300BCAEF5 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
LastUpgradeCheck = 0720;
|
||||
ORGANIZATIONNAME = "Brandon McQuilkin";
|
||||
TargetAttributes = {
|
||||
CA2FAFBB1889907300BCAEF5 = {
|
||||
@@ -701,7 +714,7 @@
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
CA2FAF971889907300BCAEF5 /* M13ProgressSuite */,
|
||||
CA2FAF971889907300BCAEF5 /* M13ProgressSuiteDemo */,
|
||||
CA2FAFBB1889907300BCAEF5 /* M13ProgressSuiteTests */,
|
||||
FB2A7BDB1B793E5600FE4E4A /* M13ProgressSuiteFramework */,
|
||||
CA2FB0431889986D00BCAEF5 /* Documentation */,
|
||||
@@ -761,6 +774,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
62BB86011C87300F0019306A /* UIApplication+M13ProgressSuite.m in Sources */,
|
||||
CA2FB02B1889946F00BCAEF5 /* SampleViewController.m in Sources */,
|
||||
CA6F31C7190EBF11008D1E64 /* LetterpressViewController.m in Sources */,
|
||||
CA2FB0221889946F00BCAEF5 /* BarViewController.m in Sources */,
|
||||
@@ -820,7 +834,7 @@
|
||||
/* Begin PBXTargetDependency section */
|
||||
CA2FAFC21889907300BCAEF5 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = CA2FAF971889907300BCAEF5 /* M13ProgressSuite */;
|
||||
target = CA2FAF971889907300BCAEF5 /* M13ProgressSuiteDemo */;
|
||||
targetProxy = CA2FAFC11889907300BCAEF5 /* PBXContainerItemProxy */;
|
||||
};
|
||||
FB2A7BF21B793E5600FE4E4A /* PBXTargetDependency */ = {
|
||||
@@ -884,6 +898,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
@@ -898,7 +913,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -931,7 +946,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
@@ -947,6 +962,7 @@
|
||||
GCC_PREFIX_HEADER = "M13ProgressSuite/M13ProgressSuite-Prefix.pch";
|
||||
INFOPLIST_FILE = "M13ProgressSuite/M13ProgressSuite-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.BrandonMcQuilkin.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -961,6 +977,7 @@
|
||||
GCC_PREFIX_HEADER = "M13ProgressSuite/M13ProgressSuite-Prefix.pch";
|
||||
INFOPLIST_FILE = "M13ProgressSuite/M13ProgressSuite-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.BrandonMcQuilkin.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -982,6 +999,7 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = "M13ProgressSuiteTests/M13ProgressSuiteTests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.BrandonMcQuilkin.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
@@ -1000,6 +1018,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "M13ProgressSuite/M13ProgressSuite-Prefix.pch";
|
||||
INFOPLIST_FILE = "M13ProgressSuiteTests/M13ProgressSuiteTests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.BrandonMcQuilkin.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
@@ -1023,6 +1042,8 @@
|
||||
FB2A7BF51B793E5600FE4E4A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
@@ -1039,10 +1060,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = M13ProgressSuiteFramework/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.BrandonMcQuilkin.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = M13ProgressSuite;
|
||||
SKIP_INSTALL = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -1052,6 +1074,8 @@
|
||||
FB2A7BF61B793E5600FE4E4A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
@@ -1065,10 +1089,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_FILE = M13ProgressSuiteFramework/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.BrandonMcQuilkin.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = M13ProgressSuite;
|
||||
SKIP_INSTALL = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -1087,7 +1112,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
CA2FAFCD1889907300BCAEF5 /* Build configuration list for PBXNativeTarget "M13ProgressSuite" */ = {
|
||||
CA2FAFCD1889907300BCAEF5 /* Build configuration list for PBXNativeTarget "M13ProgressSuiteDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
CA2FAFCE1889907300BCAEF5 /* Debug */,
|
||||
@@ -1121,6 +1146,7 @@
|
||||
FB2A7BF61B793E5600FE4E4A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
+11
-8
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0640"
|
||||
LastUpgradeVersion = "0720"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -15,7 +15,7 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "FB2A7BDB1B793E5600FE4E4A"
|
||||
BuildableName = "M13ProgressSuiteFramework.framework"
|
||||
BuildableName = "M13ProgressSuite.framework"
|
||||
BlueprintName = "M13ProgressSuiteFramework"
|
||||
ReferencedContainer = "container:M13ProgressSuite.xcodeproj">
|
||||
</BuildableReference>
|
||||
@@ -23,27 +23,30 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "FB2A7BDB1B793E5600FE4E4A"
|
||||
BuildableName = "M13ProgressSuiteFramework.framework"
|
||||
BuildableName = "M13ProgressSuite.framework"
|
||||
BlueprintName = "M13ProgressSuiteFramework"
|
||||
ReferencedContainer = "container:M13ProgressSuite.xcodeproj">
|
||||
</BuildableReference>
|
||||
@@ -52,16 +55,16 @@
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "FB2A7BDB1B793E5600FE4E4A"
|
||||
BuildableName = "M13ProgressSuiteFramework.framework"
|
||||
BuildableName = "M13ProgressSuite.framework"
|
||||
BlueprintName = "M13ProgressSuiteFramework"
|
||||
ReferencedContainer = "container:M13ProgressSuite.xcodeproj">
|
||||
</BuildableReference>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,37 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "AppIcon29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "AppIcon40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
@@ -24,6 +44,16 @@
|
||||
"filename" : "AppIcon60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
@@ -59,6 +89,11 @@
|
||||
"idiom" : "ipad",
|
||||
"filename" : "AppIcon76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.BrandonMcQuilkin.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
@property (nonatomic, retain) IBOutlet UISwitch *titleSwitch;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *finishButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *cancelButton;
|
||||
@property (weak, nonatomic) IBOutlet UISwitch *clearBackgroundSwitch;
|
||||
|
||||
- (IBAction)animateProgress:(id)sender;
|
||||
- (IBAction)progressChanged:(id)sender;
|
||||
@@ -30,5 +31,7 @@
|
||||
- (IBAction)secondaryColorChanged:(id)sender;
|
||||
- (IBAction)finish:(id)sender;
|
||||
- (IBAction)cancel:(id)sender;
|
||||
- (IBAction)backgroundColorChanged:(id)sender;
|
||||
- (IBAction)clearBackgroundChanged:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
[self.navigationController showProgress];
|
||||
[super viewDidLoad];
|
||||
[self.navigationController setBackgroundColor:[UIColor blackColor]];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
@@ -109,6 +110,23 @@
|
||||
[self.navigationController cancelProgress];
|
||||
}
|
||||
|
||||
- (IBAction)backgroundColorChanged:(id)sender
|
||||
{
|
||||
CGFloat red = (float)arc4random_uniform(256)/255.0;
|
||||
CGFloat green = (float)arc4random_uniform(256)/255.0;
|
||||
CGFloat blue = (float)arc4random_uniform(256)/255.0;
|
||||
[self.navigationController setBackgroundColor:[UIColor colorWithRed:red green:green blue:blue alpha:1.0]];
|
||||
}
|
||||
|
||||
- (IBAction)clearBackgroundChanged:(id)sender
|
||||
{
|
||||
if (_clearBackgroundSwitch.on) {
|
||||
[self.navigationController setBackgroundColor:nil];
|
||||
} else {
|
||||
[self.navigationController setBackgroundColor:[UIColor blackColor]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)primaryColorChanged:(id)sender
|
||||
{
|
||||
CGFloat red = (float)arc4random_uniform(256)/255.0;
|
||||
@@ -125,4 +143,6 @@
|
||||
[self.navigationController setSecondaryColor:[UIColor colorWithRed:red green:green blue:blue alpha:1.0]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#import "M13ProgressHUD.h"
|
||||
#import "M13ProgressViewRing.h"
|
||||
#import "AppDelegate.h"
|
||||
#import "UIApplication+M13ProgressSuite.h"
|
||||
|
||||
@interface ProgressHUDViewController ()
|
||||
|
||||
@@ -45,7 +46,7 @@
|
||||
HUD = [[M13ProgressHUD alloc] initWithProgressView:[[M13ProgressViewRing alloc] init]];
|
||||
HUD.progressViewSize = CGSizeMake(60.0, 60.0);
|
||||
HUD.animationPoint = CGPointMake([UIScreen mainScreen].bounds.size.width / 2, [UIScreen mainScreen].bounds.size.height / 2);
|
||||
UIWindow *window = ((AppDelegate *)[UIApplication sharedApplication].delegate).window;
|
||||
UIWindow *window = ((AppDelegate *)[UIApplication safeM13SharedApplication].delegate).window;
|
||||
[window addSubview:HUD];
|
||||
|
||||
}
|
||||
@@ -175,7 +176,7 @@
|
||||
{
|
||||
if (_superviewControl.selectedSegmentIndex == 0) {
|
||||
[HUD removeFromSuperview];
|
||||
UIWindow *window = ((AppDelegate *)[UIApplication sharedApplication].delegate).window;
|
||||
UIWindow *window = ((AppDelegate *)[UIApplication safeM13SharedApplication].delegate).window;
|
||||
[window addSubview:HUD];
|
||||
} else {
|
||||
[HUD removeFromSuperview];
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.BrandonMcQuilkin.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>1.2.8</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// M13ProgressSuiteFramework.h
|
||||
// M13ProgressSuiteFramework
|
||||
//
|
||||
// Created by Rusty Zarse on 8/10/15.
|
||||
// Copyright (c) 2015 Brandon McQuilkin. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for M13ProgressSuiteFramework.
|
||||
FOUNDATION_EXPORT double M13ProgressSuiteFrameworkVersionNumber;
|
||||
|
||||
//! Project version string for M13ProgressSuiteFramework.
|
||||
FOUNDATION_EXPORT const unsigned char M13ProgressSuiteFrameworkVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <M13ProgressSuiteFramework/PublicHeader.h>
|
||||
#import <M13ProgressSuite/M13ProgressConsole.h>
|
||||
#import <M13ProgressSuite/M13ProgressHUD.h>
|
||||
#import <M13ProgressSuite/UIImage+ImageEffects.h>
|
||||
#import <M13ProgressSuite/UINavigationController+M13ProgressViewBar.h>
|
||||
#import <M13ProgressSuite/M13ProgressView.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewBar.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewBorderedBar.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewFilteredImage.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewImage.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewLetterpress.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewMetro.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewMetroDotPolygon.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewPie.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewRadiative.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewRing.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewSegmentedBar.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewSegmentedRing.h>
|
||||
#import <M13ProgressSuite/M13ProgressViewStripedBar.h>
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// M13ProgressSuiteFramework.h
|
||||
// M13ProgressSuiteFramework
|
||||
//
|
||||
// Created by Rusty Zarse on 8/10/15.
|
||||
// Copyright (c) 2015 Brandon McQuilkin. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for M13ProgressSuiteFramework.
|
||||
FOUNDATION_EXPORT double M13ProgressSuiteFrameworkVersionNumber;
|
||||
|
||||
//! Project version string for M13ProgressSuiteFramework.
|
||||
FOUNDATION_EXPORT const unsigned char M13ProgressSuiteFrameworkVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <M13ProgressSuiteFramework/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.BrandonMcQuilkin.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
@@ -96,9 +96,53 @@ A set of progess view based off of the same superclass. Allowing easy switching
|
||||
|
||||
<img src="https://raw.github.com/Marxon13/M13ProgressSuite/master/ReadmeResources/StripedIndeterminate.gif">
|
||||
|
||||
Known Bugs:
|
||||
------------
|
||||
* When the HUD is set to apply the iOS 7 style blur to the HUD background, it doesn't work. The screenshot of the superview is not taken in the proper CGRect. It seems to work when the mask type is set to iOS 7 Blur, I beleive it is because the CGRectOrigin is {0, 0}.
|
||||
Progress View Usage:
|
||||
--------------------
|
||||
|
||||
All progress bars follow the same general usage:
|
||||
|
||||
```
|
||||
// Create the progress view.
|
||||
M13ProgressViewBar *progressView = [[M13ProgressViewBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 5.0)];
|
||||
|
||||
// Configure the progress view here.
|
||||
|
||||
// Add it to the view.
|
||||
[self.view addSubview: progressView];
|
||||
|
||||
// Update the progress as needed
|
||||
[progressView setProgress: 0.1 animated: YES];
|
||||
|
||||
```
|
||||
|
||||
HUD Usage:
|
||||
----------
|
||||
|
||||
```
|
||||
// Create the HUD
|
||||
M13ProgressHUD *HUD = [[M13ProgressHUD alloc] initWithProgressView:[[M13ProgressViewRing alloc] init]];
|
||||
|
||||
// Configure the progress view
|
||||
HUD.progressViewSize = CGSizeMake(60.0, 60.0);
|
||||
HUD.animationPoint = CGPointMake([UIScreen mainScreen].bounds.size.width / 2, [UIScreen mainScreen].bounds.size.height / 2);
|
||||
|
||||
// Add the HUD to the window. (Or any UIView)
|
||||
UIWindow *window = ((AppDelegate *)[UIApplication sharedApplication].delegate).window;
|
||||
[window addSubview:HUD];
|
||||
|
||||
// Show the HUD
|
||||
[HUD show:YES];
|
||||
|
||||
//Update the HUD progress
|
||||
[HUD setProgress:0.5 animated:YES];
|
||||
|
||||
// Update the HUD status
|
||||
HUD.status = @"Processing";
|
||||
|
||||
// Hide the HUD
|
||||
[HUD show:NO];
|
||||
|
||||
```
|
||||
|
||||
Contact Me:
|
||||
-------------
|
||||
|
||||
Reference in New Issue
Block a user