Merge branch 'develop' into 'master'
- Release 0.1.0 - Release 0.1.0 See merge request !1
This commit is contained in:
commit
d082cc4f18
@ -32,7 +32,8 @@
|
||||
|
||||
_imageView = [UIImageView newAutoLayoutView];
|
||||
[_imageView setBackgroundColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.6]];
|
||||
|
||||
[_imageView setContentMode:UIViewContentModeScaleAspectFit];
|
||||
|
||||
[self.view addSubview:_imageView];
|
||||
|
||||
[self.view setNeedsUpdateConstraints];
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
PODS:
|
||||
- DGActivityIndicatorView (2.0)
|
||||
- Expecta (1.0.5)
|
||||
- Expecta+Snapshots (2.0.0):
|
||||
- Expecta (~> 1.0)
|
||||
@ -9,6 +10,7 @@ PODS:
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.7):
|
||||
- FBSnapshotTestCase/Core
|
||||
- PNImagePickerViewController (0.1.0):
|
||||
- DGActivityIndicatorView
|
||||
- PureLayout
|
||||
- PureLayout (3.0.1)
|
||||
- Specta (1.0.5)
|
||||
@ -26,10 +28,11 @@ EXTERNAL SOURCES:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
DGActivityIndicatorView: 52875b025a6ccf6a431a905285c12e2bb95eb559
|
||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
|
||||
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
|
||||
PNImagePickerViewController: 9eaf2575e70de776463e23904f9d466f98d27ad4
|
||||
PNImagePickerViewController: 8225ee425aa04f1f3716c7ea9786561de3782096
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallBeatAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallBeatAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,57 @@
|
||||
//
|
||||
// DGActivityIndicatorBallBeatAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallBeatAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallBeatAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.7f;
|
||||
NSArray *beginTimes = @[@0.35f, @0.0f, @0.35f];
|
||||
CGFloat circleSpacing = 2.0f;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - circleSize) / 2;
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[@1.0f, @0.75f, @1.0f];
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.2f, @1.0f];
|
||||
|
||||
// Aniamtion
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
// Draw circles
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, circleSize, circleSize) cornerRadius:circleSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake(x + circleSize * i + circleSpacing * i, y, circleSize, circleSize);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallClipRotateAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,52 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallClipRotateAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallClipRotateAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.75f;
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
rotateAnimation.values = @[@0, @M_PI, @(2 * M_PI)];
|
||||
rotateAnimation.keyTimes = scaleAnimation.keyTimes;
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw ball clip
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(size.width / 2, size.height / 2) radius:size.width / 2 startAngle:1.5 * M_PI endAngle:M_PI clockwise:true];
|
||||
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateMultipleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallClipRotateMultipleAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,90 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotateMultipleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallClipRotateMultipleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallClipRotateMultipleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat bigDuration = 1.0f;
|
||||
CGFloat smallDuration = bigDuration / 2;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
// Big circle
|
||||
{
|
||||
CGFloat circleSize = size.width;
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPath];
|
||||
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-3 * M_PI / 4 endAngle:-M_PI / 4 clockwise:true];
|
||||
[circlePath moveToPoint:CGPointMake(circleSize / 2 - circleSize / 2 * cosf(M_PI / 4), circleSize / 2 + circleSize / 2 * sinf(M_PI / 4))];
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-5 * M_PI / 4 endAngle:-7 * M_PI / 4 clockwise:false];
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation: [self createAnimationInDuration:bigDuration withTimingFunction:timingFunction reverse:false] forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Small circle
|
||||
{
|
||||
CGFloat circleSize = size.width / 2;
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPath];
|
||||
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:3 * M_PI / 4 endAngle:5 * M_PI / 4 clockwise:true];
|
||||
[circlePath moveToPoint:CGPointMake(circleSize / 2 + circleSize / 2 * cosf(M_PI / 4), circleSize / 2 - circleSize / 2 * sinf(M_PI / 4))];
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-M_PI / 4 endAngle:M_PI / 4 clockwise:true];
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:[self createAnimationInDuration:smallDuration withTimingFunction:timingFunction reverse:true] forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
- (CAAnimation *)createAnimationInDuration:(CGFloat) duration withTimingFunction:(CAMediaTimingFunction *) timingFunction reverse:(BOOL) reverse {
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
if (!reverse) {
|
||||
rotateAnimation.values = @[@0, @M_PI, @(2 * M_PI)];
|
||||
} else {
|
||||
rotateAnimation.values = @[@0, @-M_PI, @(-2 * M_PI)];
|
||||
}
|
||||
rotateAnimation.keyTimes = scaleAnimation.keyTimes;
|
||||
rotateAnimation.duration = duration;
|
||||
rotateAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.duration = duration;
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotatePulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallClipRotatePulseAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,85 @@
|
||||
//
|
||||
// DGActivityIndicatorBallClipRotatePulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallClipRotatePulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallClipRotatePulseAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.09f :0.57f :0.49f :0.9f];
|
||||
|
||||
// Small circle
|
||||
{
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.3f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.3f, 0.3f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.repeatCount = HUGE_VALF;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
CGFloat circleSize = size.width / 2;
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
[circle addAnimation:scaleAnimation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Big circle
|
||||
{
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
rotateAnimation.values = @[@0, @M_PI, @(2 * M_PI)];
|
||||
rotateAnimation.keyTimes = scaleAnimation.keyTimes;
|
||||
rotateAnimation.duration = duration;
|
||||
rotateAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw big circle
|
||||
CGFloat circleSize = size.width;
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPath];
|
||||
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-3 * M_PI / 4 endAngle:-M_PI / 4 clockwise:true];
|
||||
[circlePath moveToPoint:CGPointMake(circleSize / 2 - circleSize / 2 * cosf(M_PI / 4), circleSize / 2 + circleSize / 2 * sinf(M_PI / 4))];
|
||||
[circlePath addArcWithCenter:CGPointMake(circleSize / 2, circleSize / 2) radius:circleSize / 2 startAngle:-5 * M_PI / 4 endAngle:-7 * M_PI / 4 clockwise:false];
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.lineWidth = 2;
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridBeatAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallGridBeatAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,55 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridBeatAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallGridBeatAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallGridBeatAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSArray *durations = @[@0.96f, @0.93f, @1.19f, @1.13f, @1.34f, @0.94f, @1.2f, @0.82f, @1.19f];
|
||||
NSArray *timeOffsets = @[@0.36f, @0.4f, @0.68f, @0.41f, @0.71f, @-0.15f, @-0.12f, @0.01f, @0.32f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
|
||||
CGFloat circleSpacing = 2;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
animation.beginTime = CACurrentMediaTime();
|
||||
animation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
animation.values = @[@1.0f, @0.7f, @1.0f];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Draw circle
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
CALayer *circle = [self createCirleWith:circleSize color:tintColor];
|
||||
|
||||
animation.duration = [durations[3 * i + j] floatValue];
|
||||
animation.timeOffset = [timeOffsets[3 * i + j] floatValue];
|
||||
circle.frame = CGRectMake(x + circleSize * j + circleSpacing * j, y + circleSize * i + circleSpacing * i, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CALayer *)createCirleWith:(CGFloat)size color:(UIColor *)color {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size, size) cornerRadius:size / 2];
|
||||
|
||||
circle.fillColor = color.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridPulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallGridPulseAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,67 @@
|
||||
//
|
||||
// DGActivityIndicatorBallGridPulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallGridPulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallGridPulseAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSArray *durations = @[@0.72f, @1.02f, @1.28f, @1.42f, @1.45f, @1.18f, @0.87f, @1.45f, @1.06f];
|
||||
NSArray *timeOffsets = @[@-0.06f, @0.25f, @-0.17f, @0.48f, @0.31f, @0.03f, @0.46f, @0.78f, @0.45f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
|
||||
CGFloat circleSpacing = 2;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[@1.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.7f, @1.0f];
|
||||
opacityAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.beginTime = CACurrentMediaTime();
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
CALayer *circle = [self createCirleWith:circleSize color:tintColor];
|
||||
|
||||
animation.duration = [durations[3 * i + j] floatValue];
|
||||
animation.timeOffset = [timeOffsets[3 * i + j] floatValue];
|
||||
circle.frame = CGRectMake(x + circleSize * j + circleSpacing * j, y + circleSize * i + circleSpacing * i, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CALayer *)createCirleWith:(CGFloat)size color:(UIColor *)color {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size, size) cornerRadius:size / 2];
|
||||
|
||||
circle.fillColor = color.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallPulseAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,44 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/19/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallPulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallPulseAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat circlePadding = 5.0f;
|
||||
CGFloat circleSize = (size.width - 2 * circlePadding) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - circleSize) / 2;
|
||||
CGFloat duration = 0.75f;
|
||||
NSArray *timeBegins = @[@0.12f, @0.24f, @0.36f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.2f :0.68f :0.18f :1.08f];
|
||||
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.3f, 0.3f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
animation.keyTimes = @[@0.0f, @0.3f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake(x + i * circleSize + i * circlePadding, y, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circle.bounds.size.width / 2;
|
||||
animation.beginTime = [timeBegins[i] floatValue];
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseSyncAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallPulseSyncAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// DGActivityIndicatorBallPulseSyncAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallPulseSyncAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallPulseSyncAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.6f;
|
||||
NSArray *beginTimes = @[@0.07f, @0.14f, @0.21f];
|
||||
CGFloat circleSpacing = 2.0f;
|
||||
CGFloat circleSize = (size.width - circleSpacing * 2) / 3;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - circleSize) / 2;
|
||||
CGFloat deltaY = (size.height / 2 - circleSize / 2) / 2;
|
||||
CAMediaTimingFunction *timingFunciton = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.values = @[@0.0f, @(deltaY), @(-deltaY), @0.0f];
|
||||
animation.timingFunctions = @[timingFunciton, timingFunciton, timingFunciton];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circles
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, circleSize, circleSize) cornerRadius:circleSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake(x + circleSize * i + circleSpacing * i, y, circleSize, circleSize);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallRotateAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallRotateAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,74 @@
|
||||
//
|
||||
// DGActivityIndicatorBallRotateAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallRotateAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallRotateAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.7f :-0.13f :0.22f :0.86f];
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
scaleAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.6f, 0.6f, 1.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 1.0f)]];
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Rotate animation
|
||||
CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||
|
||||
rotateAnimation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
rotateAnimation.values = @[@0, @-M_PI, @(-2 * M_PI)];
|
||||
rotateAnimation.duration = duration;
|
||||
rotateAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, rotateAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circles
|
||||
CALayer *leftCircle = [CALayer layer];
|
||||
|
||||
leftCircle.backgroundColor = tintColor.CGColor;
|
||||
leftCircle.opacity = 0.8f;
|
||||
leftCircle.cornerRadius = circleSize / 2;
|
||||
leftCircle.frame = CGRectMake(0, (size.height - circleSize) / 2, circleSize, circleSize);
|
||||
|
||||
CALayer *rightCircle = [CALayer layer];
|
||||
|
||||
rightCircle.backgroundColor = tintColor.CGColor;
|
||||
rightCircle.opacity = 0.8f;
|
||||
rightCircle.cornerRadius = circleSize / 2;
|
||||
rightCircle.frame = CGRectMake(size.width - circleSize, (size.height - circleSize) / 2, circleSize, circleSize);
|
||||
|
||||
CALayer *centerCircle = [CALayer layer];
|
||||
|
||||
centerCircle.backgroundColor = tintColor.CGColor;
|
||||
centerCircle.cornerRadius = circleSize / 2;
|
||||
centerCircle.frame = CGRectMake((size.width - circleSize) / 2, (size.height - circleSize) / 2, circleSize, circleSize);
|
||||
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[circle addSublayer:leftCircle];
|
||||
[circle addSublayer:rightCircle];
|
||||
[circle addSublayer:centerCircle];
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,49 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
|
||||
// Scale animation
|
||||
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.fromValue = @0.0f;
|
||||
scaleAnimation.toValue = @1.0f;
|
||||
|
||||
// Opacity animation
|
||||
CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.fromValue = @1.0f;
|
||||
opacityAnimation.toValue = @0.0f;
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleMultipleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleMultipleAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,53 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleMultipleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleMultipleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleMultipleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
NSArray *beginTimes = @[@0.0f, @0.2f, @0.4f];
|
||||
|
||||
// Scale animation
|
||||
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.fromValue = @0.0f;
|
||||
scaleAnimation.toValue = @1.0f;
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.05f, @1.0f];
|
||||
opacityAnimation.values = @[@0.0f, @1.0f, @0.0f];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
circle.fillColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
circle.opacity = 0.0f;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleTrippleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleRippleAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,53 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleTrippleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleRippleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleRippleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.21f :0.53f :0.56f :0.8f];
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.7f];
|
||||
scaleAnimation.values = @[@0.1f, @1.0f];
|
||||
scaleAnimation.timingFunction = timingFunction;
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.7f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.7f, @0.0f];
|
||||
opacityAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
circle.fillColor = nil;
|
||||
circle.lineWidth = 2;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleRippleMultipleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallScaleRippleMultipleAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,58 @@
|
||||
//
|
||||
// DGActivityIndicatorBallScaleRippleMultipleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallScaleRippleMultipleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallScaleRippleMultipleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.25f;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.21f :0.53f :0.56f :0.8f];
|
||||
NSArray *timeOffsets = @[@0.0f, @0.2f, @0.4f];
|
||||
|
||||
// Scale animation
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.duration = duration;
|
||||
scaleAnimation.keyTimes = @[@0.0f, @0.7f];
|
||||
scaleAnimation.values = @[@0.1f, @1.0f];
|
||||
scaleAnimation.timingFunction = timingFunction;
|
||||
|
||||
// Opacity animation
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.duration = duration;
|
||||
opacityAnimation.keyTimes = @[@0.0f, @0.7f, @1.0f];
|
||||
opacityAnimation.values = @[@1.0f, @0.7f, @0.0f];
|
||||
opacityAnimation.timingFunctions = @[timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[scaleAnimation, opacityAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.beginTime = CACurrentMediaTime();
|
||||
|
||||
// Draw circles
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2];
|
||||
|
||||
animation.timeOffset = [timeOffsets[i] floatValue];
|
||||
circle.fillColor = nil;
|
||||
circle.lineWidth = 2;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
circle.path = circlePath.CGPath;
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - size.width) / 2, (layer.bounds.size.height - size.height) / 2, size.width, size.height);
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallSpinFadeLoader.h
|
||||
// CheeseDigest
|
||||
//
|
||||
// Created by Robin.Chao on 9/8/15.
|
||||
// Copyright (c) 2015 mRocker. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallSpinFadeLoader : NSObject<DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,86 @@
|
||||
//
|
||||
// DGActivityIndicatorBallSpinFadeLoader.m
|
||||
// CheeseDigest
|
||||
//
|
||||
// Created by Robin.Chao on 9/8/15.
|
||||
// Copyright (c) 2015 mRocker. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallSpinFadeLoader.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallSpinFadeLoader
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
|
||||
CGFloat circleSpacing = -2;
|
||||
CGFloat circleSize = (size.width - 4 * circleSpacing) / 5;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
CFTimeInterval duration = 1;
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
NSArray *beginTimes = @[@0, @0.12, @0.24, @0.36, @0.48, @0.6, @0.72, @0.84];
|
||||
|
||||
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
scaleAnimation.keyTimes = @[@0, @0.5, @1];
|
||||
scaleAnimation.values = @[@1, @0.4, @1];
|
||||
scaleAnimation.duration = duration;
|
||||
|
||||
|
||||
CAKeyframeAnimation *opacityAnimaton = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
|
||||
opacityAnimaton.keyTimes = @[@0, @0.5, @1];
|
||||
opacityAnimaton.values = @[@1, @0.3, @1];
|
||||
opacityAnimaton.duration = duration;
|
||||
|
||||
|
||||
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
animationGroup.animations = @[scaleAnimation, opacityAnimaton];
|
||||
animationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animationGroup.duration = duration;
|
||||
animationGroup.repeatCount = HUGE;
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CALayer *circle = [self circleLayer:(M_PI_4 * i) size:circleSize origin:CGPointMake(x, y) containerSize:size color:tintColor];
|
||||
animationGroup.beginTime = beginTime + [beginTimes[i] doubleValue];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:animationGroup forKey:@"animation"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (CALayer *)circleLayer:(CGFloat)angle size:(CGFloat)size origin:(CGPoint)origin containerSize:(CGSize)containerSize color:(UIColor *)color{
|
||||
CGFloat radius = containerSize.width/2;
|
||||
CALayer *circle = [self createLayerWith:CGSizeMake(size, size) color:color];
|
||||
CGRect frame = CGRectMake((origin.x + radius * (cos(angle) + 1) - size / 2), origin.y + radius * (sin(angle) + 1) - size / 2, size, size);
|
||||
circle.frame = frame;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
- (CALayer *)createLayerWith:(CGSize)size color:(UIColor *)color{
|
||||
CAShapeLayer *layer = [CAShapeLayer layer];
|
||||
UIBezierPath *path = [UIBezierPath bezierPath];
|
||||
|
||||
[path addArcWithCenter:CGPointMake(size.width / 2,size.height / 2) radius:(size.width / 2) startAngle:0 endAngle:2 * M_PI clockwise:NO];
|
||||
layer.fillColor = color.CGColor;
|
||||
layer.backgroundColor = nil;
|
||||
layer.path = path.CGPath;
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallTrianglePathAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallTrianglePathAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,100 @@
|
||||
//
|
||||
// DGActivityIndicatorBallTrianglePathAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallTrianglePathAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallTrianglePathAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 2.0f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CGFloat deltaX = size.width / 2 - circleSize / 2;
|
||||
CGFloat deltaY = size.height / 2 - circleSize / 2;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.duration = duration;
|
||||
animation.timingFunctions = @[timingFunction, timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Top-center circle
|
||||
CALayer *topCenterCircle = [self createCircleWithSize:circleSize color:tintColor];
|
||||
|
||||
[self changeAnimation:animation values:@[@"{0,0}", @"{hx,fy}", @"{-hx,fy}", @"{0,0}"] deltaX:deltaX deltaY:deltaY];
|
||||
topCenterCircle.frame = CGRectMake(x + size.width / 2 - circleSize / 2, y, circleSize, circleSize);
|
||||
[topCenterCircle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:topCenterCircle];
|
||||
|
||||
// Bottom-left circle
|
||||
CALayer *bottomLeftCircle = [self createCircleWithSize:circleSize color:tintColor];
|
||||
|
||||
[self changeAnimation:animation values:@[@"{0,0}", @"{hx,-fy}", @"{fx,0}", @"{0,0}"] deltaX:deltaX deltaY:deltaY];
|
||||
bottomLeftCircle.frame = CGRectMake(x, y + size.height - circleSize, circleSize, circleSize);
|
||||
[bottomLeftCircle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:bottomLeftCircle];
|
||||
|
||||
// Bottom-right circle
|
||||
CALayer *bottomRigthCircle = [self createCircleWithSize:circleSize color:tintColor];
|
||||
|
||||
[self changeAnimation:animation values:@[@"{0,0}", @"{-fx,0}", @"{-hx,-fy}", @"{0,0}"] deltaX:deltaX deltaY:deltaY];
|
||||
bottomRigthCircle.frame = CGRectMake(x + size.width - circleSize, y + size.height - circleSize, circleSize, circleSize);
|
||||
[bottomRigthCircle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:bottomRigthCircle];
|
||||
}
|
||||
|
||||
- (CALayer *)createCircleWithSize:(CGFloat)size color:(UIColor *)color {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size, size) cornerRadius:size / 2];
|
||||
|
||||
circle.fillColor = nil;
|
||||
circle.strokeColor = color.CGColor;
|
||||
circle.lineWidth = 1;
|
||||
circle.path = circlePath.CGPath;
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
- (CAAnimation *)changeAnimation:(CAKeyframeAnimation *)animation values:(NSArray *)rawValues deltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY {
|
||||
NSMutableArray *values = [NSMutableArray arrayWithCapacity:5];
|
||||
|
||||
for (NSString *rawValue in rawValues) {
|
||||
CGPoint point = CGPointFromString([self translate:rawValue withDeltaX:deltaX deltaY:deltaY]);
|
||||
|
||||
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(point.x, point.y, 0)]];
|
||||
}
|
||||
animation.values = values;
|
||||
|
||||
return animation;
|
||||
}
|
||||
|
||||
- (NSString *)translate:(NSString *)valueString withDeltaX:(CGFloat)deltaX deltaY:(CGFloat)deltaY {
|
||||
NSMutableString *valueMutableString = [NSMutableString stringWithString:valueString];
|
||||
CGFloat fullDeltaX = 2 * deltaX;
|
||||
CGFloat fullDeltaY = 2 * deltaY;
|
||||
NSRange range;
|
||||
|
||||
range.location = 0;
|
||||
range.length = valueString.length;
|
||||
|
||||
[valueMutableString replaceOccurrencesOfString:@"hx" withString:[NSString stringWithFormat:@"%f", deltaX] options:NSCaseInsensitiveSearch range:range];
|
||||
range.length = valueMutableString.length;
|
||||
[valueMutableString replaceOccurrencesOfString:@"fx" withString:[NSString stringWithFormat:@"%f", fullDeltaX] options:NSCaseInsensitiveSearch range:range];
|
||||
range.length = valueMutableString.length;
|
||||
[valueMutableString replaceOccurrencesOfString:@"hy" withString:[NSString stringWithFormat:@"%f", deltaY] options:NSCaseInsensitiveSearch range:range];
|
||||
range.length = valueMutableString.length;
|
||||
[valueMutableString replaceOccurrencesOfString:@"fy" withString:[NSString stringWithFormat:@"%f", fullDeltaY] options:NSCaseInsensitiveSearch range:range];
|
||||
|
||||
return valueMutableString;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallZigZagAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,60 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallZigZagAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallZigZagAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.7f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CGFloat deltaX = size.width / 2 - circleSize / 2;
|
||||
CGFloat deltaY = size.height / 2 - circleSize / 2;
|
||||
|
||||
// Circle 1 animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw circle 1
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Circle 2 animation
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
|
||||
// Draw circle 2
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagDeflectAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorBallZigZagDeflectAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,61 @@
|
||||
//
|
||||
// DGActivityIndicatorBallZigZagDeflectAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorBallZigZagDeflectAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorBallZigZagDeflectAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.75f;
|
||||
CGFloat circleSize = size.width / 5;
|
||||
CGFloat deltaX = size.width / 2 - circleSize / 2;
|
||||
CGFloat deltaY = size.height / 2 - circleSize / 2;
|
||||
|
||||
// Circle 1 animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
|
||||
animation.duration = duration;
|
||||
animation.keyTimes = @[@0.0f, @0.33f, @0.66f, @1.0f];
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, -deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.autoreverses = true;
|
||||
|
||||
// Draw circle 1
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
|
||||
// Circle 2 animation
|
||||
animation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-deltaX, deltaY, 0)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, 0, 0)]];
|
||||
|
||||
// Draw circle 2
|
||||
{
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.cornerRadius = circleSize / 2;
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize) / 2, (layer.bounds.size.height - circleSize) / 2, circleSize, circleSize);
|
||||
[circle addAnimation:animation forKey:@"animation"];
|
||||
[layer addSublayer:circle];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,14 @@
|
||||
//
|
||||
// DGActivityIndicatorCookieTerminatorAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/28.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorCookieTerminatorAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
|
||||
@end
|
||||
@ -0,0 +1,82 @@
|
||||
//
|
||||
// DGActivityIndicatorCookieTerminatorAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/28.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorCookieTerminatorAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorCookieTerminatorAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat cookieTerminatorSize = ceilf(size.width / 3.0f);
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = layer.bounds.size.height / 2.0f;
|
||||
CGPoint cookieTerminatorCenter = CGPointMake(oX, oY);
|
||||
|
||||
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:cookieTerminatorCenter radius:cookieTerminatorSize startAngle:M_PI_4 endAngle:M_PI * 1.75f clockwise:YES];
|
||||
[path addLineToPoint:cookieTerminatorCenter];
|
||||
[path closePath];
|
||||
|
||||
CAShapeLayer *cookieTerminatorLayer = [CAShapeLayer layer];
|
||||
cookieTerminatorLayer.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
cookieTerminatorLayer.fillColor = tintColor.CGColor;
|
||||
cookieTerminatorLayer.path = path.CGPath;
|
||||
[layer addSublayer:cookieTerminatorLayer];
|
||||
|
||||
path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(0.0f, 0.0f) radius:cookieTerminatorSize startAngle:M_PI_2 endAngle:M_PI * 1.5f clockwise:YES];
|
||||
[path closePath];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CAShapeLayer *jawLayer = [CAShapeLayer layer];
|
||||
jawLayer.path = path.CGPath;
|
||||
jawLayer.fillColor = tintColor.CGColor;
|
||||
jawLayer.position = cookieTerminatorCenter;
|
||||
jawLayer.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
jawLayer.opacity = 1.0f;
|
||||
jawLayer.transform = CATransform3DMakeRotation((1.0f - 2.0f * i) * M_PI_4, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.duration = 0.3f;
|
||||
transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation((1.0f - 2.0f * i) * M_PI_4, 0.0f, 0.0f, 1.0f)];
|
||||
transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation((1.0f - 2.0f * i) * M_PI_2, 0.0f, 0.0f, 1.0f)];
|
||||
transformAnimation.autoreverses = YES;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
[layer addSublayer:jawLayer];
|
||||
[jawLayer addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
|
||||
CGFloat cookieSize = ceilf(size.width / 6.0f);
|
||||
CGFloat cookiePadding = cookieSize * 2.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *cookieLayer = [CALayer layer];
|
||||
cookieLayer.frame = CGRectMake(cookieTerminatorCenter.x + (cookieSize + cookiePadding) * 3.0f - cookieTerminatorSize, oY - cookieSize / 2.0f, cookieSize, cookieSize);
|
||||
cookieLayer.backgroundColor = tintColor.CGColor;
|
||||
cookieLayer.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
cookieLayer.opacity = 1.0f;
|
||||
cookieLayer.cornerRadius = cookieSize / 2.0f;
|
||||
|
||||
CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.duration = 1.8f;
|
||||
transformAnimation.beginTime = beginTime - (i * transformAnimation.duration / 3.0f);
|
||||
transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f)];
|
||||
transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-3.0f * (cookieSize + cookiePadding), 0.0f, 0.0f)];
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:cookieLayer];
|
||||
[cookieLayer addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorDoubleBounceAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorDoubleBounceAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,51 @@
|
||||
//
|
||||
// DGActivityIndicatorDoubleBounceAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorDoubleBounceAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorDoubleBounceAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.height) / 2.0f;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX, oY, size.width, size.height);
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 0.5f;
|
||||
circle.cornerRadius = size.height / 2.0f;
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 2.0f;
|
||||
transformAnimation.beginTime = beginTime - (1.0f * i);
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(0.5f), @(1.0f)];
|
||||
|
||||
transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)]];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorFiveDotsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorFiveDotsAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,99 @@
|
||||
//
|
||||
// DGActivityIndicatorFiveDotsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorFiveDotsAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorFiveDotsAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat circleSize = size.width / 5.0f;
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - circleSize * 5) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - circleSize) / 2.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX + circleSize * 2 * i, oY, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t1 = CATransform3DScale(t1, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation(0.0f, -2 * circleSize, 0.0f);
|
||||
t2 = CATransform3DScale(t2, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t3 = CATransform3DScale(t3, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
CATransform3D t4 = CATransform3DMakeTranslation(0.0f, 2 * circleSize, 0.0f);
|
||||
t4 = CATransform3DScale(t4, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t5 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t5 = CATransform3DScale(t5, 1.f, 1.0f, 0.0f);
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3],
|
||||
[NSValue valueWithCATransform3D:t4],
|
||||
[NSValue valueWithCATransform3D:t5]];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 1.0f;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake((layer.bounds.size.width - circleSize * 5) / 2.0f + circleSize + circleSize * 2 * i, (layer.bounds.size.height - circleSize) / 2.0f, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t1 = CATransform3DScale(t1, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation(0.0f, 2 * circleSize, 0.0f);
|
||||
t2 = CATransform3DScale(t2, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, -2 * circleSize, 0.0f);
|
||||
t3 = CATransform3DScale(t3, 1.f, 1.0f, 0.0f);
|
||||
|
||||
CATransform3D t4 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t4 = CATransform3DScale(t4, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3],
|
||||
[NSValue valueWithCATransform3D:t4]];
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(0.25f), @(0.75f), @(1.0f)];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 1.0f;
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScaleAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorLineScaleAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,43 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScaleAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorLineScaleAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorLineScaleAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
NSArray *beginTimes = @[@0.1f, @0.2f, @0.3f, @0.4f, @0.5f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.2f :0.68f :0.18f :1.08f];
|
||||
CGFloat lineSize = size.width / 9;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale.y"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
animation.values = @[@1.0f, @0.4f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.duration = duration;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
CAShapeLayer *line = [CAShapeLayer layer];
|
||||
UIBezierPath *linePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, lineSize, size.height) cornerRadius:lineSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
line.fillColor = tintColor.CGColor;
|
||||
line.path = linePath.CGPath;
|
||||
[line addAnimation:animation forKey:@"animation"];
|
||||
line.frame = CGRectMake(x + lineSize * 2 * i, y, lineSize, size.height);
|
||||
[layer addSublayer:line];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScalePartyAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorLineScalePartyAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,43 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScalePartyAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorLineScalePartyAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorLineScalePartyAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSArray *durations = @[@1.26f, @0.43f, @1.01f, @0.73f];
|
||||
NSArray *beginTimes = @[@0.77f, @0.29f, @0.28f, @0.74f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
|
||||
CGFloat lineSize = size.width / 7;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
animation.values = @[@1.0f, @0.5f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
CAShapeLayer *line = [CAShapeLayer layer];
|
||||
UIBezierPath *linePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, lineSize, size.height) cornerRadius:lineSize / 2];
|
||||
|
||||
animation.duration = [durations[i] floatValue];
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
line.fillColor = tintColor.CGColor;
|
||||
line.path = linePath.CGPath;
|
||||
[line addAnimation:animation forKey:@"animation"];
|
||||
line.frame = CGRectMake(x + lineSize * 2 * i, y, lineSize, size.height);
|
||||
[layer addSublayer:line];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScalePulseOutAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorLineScalePulseOutAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,43 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScalePulseOutAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorLineScalePulseOutAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorLineScalePulseOutAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 1.0f;
|
||||
NSArray *beginTimes = @[@0.4f, @0.2f, @0.0f, @0.2f, @0.4f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.85f :0.25f :0.37f :0.85f];
|
||||
CGFloat lineSize = size.width / 9;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale.y"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.5f, @1.0f];
|
||||
animation.values = @[@1.0f, @0.4f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.duration = duration;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
CAShapeLayer *line = [CAShapeLayer layer];
|
||||
UIBezierPath *linePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, lineSize, size.height) cornerRadius:lineSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
line.fillColor = tintColor.CGColor;
|
||||
line.path = linePath.CGPath;
|
||||
[line addAnimation:animation forKey:@"animation"];
|
||||
line.frame = CGRectMake(x + lineSize * 2 * i, y, lineSize, size.height);
|
||||
[layer addSublayer:line];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScalePulseOutRapidAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorLineScalePulseOutRapidAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,43 @@
|
||||
//
|
||||
// DGActivityIndicatorLineScalePulseOutRapidAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorLineScalePulseOutRapidAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorLineScalePulseOutRapidAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 0.9f;
|
||||
NSArray *beginTimes = @[@0.5f, @0.25f, @0.0f, @0.25f, @0.5f];
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.11f :0.49f :0.38f :0.78f];
|
||||
CGFloat lineSize = size.width / 9;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
|
||||
// Animation
|
||||
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale.y"];
|
||||
|
||||
animation.keyTimes = @[@0.0f, @0.8f, @0.9f];
|
||||
animation.values = @[@1.0f, @0.3f, @1.0f];
|
||||
animation.timingFunctions = @[timingFunction, timingFunction];
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
animation.duration = duration;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
CAShapeLayer *line = [CAShapeLayer layer];
|
||||
UIBezierPath *linePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, lineSize, size.height) cornerRadius:lineSize / 2];
|
||||
|
||||
animation.beginTime = [beginTimes[i] floatValue];
|
||||
line.fillColor = tintColor.CGColor;
|
||||
line.path = linePath.CGPath;
|
||||
[line addAnimation:animation forKey:@"animation"];
|
||||
line.frame = CGRectMake(x + lineSize * 2 * i, y, lineSize, size.height);
|
||||
[layer addSublayer:line];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorNineDotsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorNineDotsAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,62 @@
|
||||
//
|
||||
// DGActivityIndicatorNineDotsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorNineDotsAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorNineDotsAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat circleSize = size.width / 4.0f;
|
||||
CGFloat circlePadding = circleSize / 2.0f;
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - circleSize * 3 - circlePadding * 2) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - circleSize * 3 - circlePadding * 2) / 2.0f;
|
||||
|
||||
NSArray *timeOffsets = @[@(0.11f), @(0.42f), @(0.0f),
|
||||
@(0.65f), @(0.48f), @(0.2f),
|
||||
@(0.63f), @(0.95f), @(0.62f)];
|
||||
NSArray *durations = @[@(0.72f), @(1.02f), @(1.28f),
|
||||
@(1.42f), @(1.45f), @(1.18f),
|
||||
@(0.87f), @(1.45f), @(1.06f)];
|
||||
|
||||
for (int i = 0; i < MIN(timeOffsets.count, durations.count); i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX + (circleSize + circlePadding) * (i % 3), oY + (circleSize + circlePadding) * (int)(i / 3), circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5f, 0.5f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5f, 0.5f, 0.0f)]];
|
||||
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
opacityAnimation.values = @[@(0.5f), @(1.0f), @(0.5f)];
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
animationGroup.beginTime = beginTime;
|
||||
animationGroup.repeatCount = HUGE_VALF;
|
||||
animationGroup.duration = [durations[i] doubleValue];
|
||||
animationGroup.animations = @[transformAnimation, opacityAnimation];
|
||||
animationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
animationGroup.timeOffset = [timeOffsets[i] doubleValue];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:animationGroup forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,14 @@
|
||||
//
|
||||
// DGActivityIndicatorRotatingTrigonsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/26.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorRotatingSandglassAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
|
||||
@end
|
||||
@ -0,0 +1,62 @@
|
||||
//
|
||||
// DGActivityIndicatorRotatingTrigonsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/26.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorRotatingSandglassAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorRotatingSandglassAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat circleSize = size.width / 4.0f;;
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.width) / 2.0f;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX + i * (size.width - 2.0f * circleSize), (size.height - circleSize) * i + oY, circleSize, circleSize);
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.shouldRasterize = YES;
|
||||
circle.rasterizationScale = [[UIScreen mainScreen] scale];
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 0.8f;
|
||||
transformAnimation.beginTime = beginTime;
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(1.0f / 3.0f), @(2.0f / 3.0f), @(1.0)];
|
||||
|
||||
transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation((1.0f - 2.0f * i) * (size.width - 2.0f * circleSize), 0.0f, 0.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation((1.0f - 2.0f * i) * (size.width - 2.0f * circleSize) / 2.0f, (1.0f - 2.0f * i) * (size.height - circleSize) / 2.0f, 0.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DIdentity],
|
||||
[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3]];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorRotatingSquaresAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorRotatingSquaresAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,73 @@
|
||||
//
|
||||
// DGActivityIndicatorRotatingSquaresAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorRotatingSquaresAnimation.h"
|
||||
|
||||
static CGFloat degreesToRadians(CGFloat degrees) { return (degrees) / 180.0 * M_PI; };
|
||||
|
||||
@implementation DGActivityIndicatorRotatingSquaresAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat squareSize = floor(size.width / 4.0f);
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.height) / 2.0f;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *square = [CALayer layer];
|
||||
square.frame = CGRectMake(oX, oY, squareSize, squareSize);
|
||||
square.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
square.backgroundColor = tintColor.CGColor;
|
||||
square.shouldRasterize = YES;
|
||||
square.rasterizationScale = [[UIScreen mainScreen] scale];
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.duration = 1.6f;
|
||||
transformAnimation.beginTime = beginTime - (i * transformAnimation.duration / 2.0f);
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(0.25f), @(0.50f), @(0.75f), @(1.0f)];
|
||||
transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation(size.width - squareSize, 0.0f, 0.0f);
|
||||
t1 = CATransform3DRotate(t1, degreesToRadians(-90.0f), 0.0f, 0.0f, 1.0f);
|
||||
t1 = CATransform3DScale(t1, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation(size.width - squareSize, size.height - squareSize, 0.0f);
|
||||
t2 = CATransform3DRotate(t2, degreesToRadians(-180.0f), 0.0f, 0.0f, 1.0f);
|
||||
t2 = CATransform3DScale(t2, 1.0, 1.0, 1.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, size.height - squareSize, 0.0f);
|
||||
t3 = CATransform3DRotate(t3, degreesToRadians(-270.0f), 0.0f, 0.0f, 1.0f);
|
||||
t3 = CATransform3DScale(t3, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
CATransform3D t4 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
t4 = CATransform3DRotate(t4, degreesToRadians(-360.0f), 0.0f, 0.0f, 1.0f);
|
||||
t4 = CATransform3DScale(t4, 1.0, 1.0, 1.0f);
|
||||
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DIdentity],
|
||||
[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3],
|
||||
[NSValue valueWithCATransform3D:t4]];
|
||||
|
||||
[layer addSublayer:square];
|
||||
[square addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,14 @@
|
||||
//
|
||||
// DGActivityIndicatorRotatingTrigonsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/26.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorRotatingTrigonAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
|
||||
@end
|
||||
@ -0,0 +1,68 @@
|
||||
//
|
||||
// DGActivityIndicatorRotatingTrigonsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/26.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorRotatingTrigonAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorRotatingTrigonAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat circleSize = size.width / 4.0f;;
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.width) / 2.0f;
|
||||
|
||||
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, circleSize, circleSize)];
|
||||
CGPoint pointA = CGPointMake(oX + size.width / 2.0f, oY + circleSize / 2.0f);
|
||||
CGPoint pointB = CGPointMake(oX + circleSize / 2.0f, oY + circleSize / 2.0f + sqrtf(powf((size.width - circleSize), 2) - powf((size.width / 2.0f - circleSize / 2.0f), 2)));
|
||||
CGPoint pointC = CGPointMake(oX + size.width - circleSize / 2.0f, pointB.y);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
circle.path = path.CGPath;
|
||||
circle.fillColor = [UIColor clearColor].CGColor;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
circle.bounds = CGRectMake(0, 0, circleSize, circleSize);
|
||||
circle.position = pointA;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
circle.shouldRasterize = YES;
|
||||
circle.rasterizationScale = [[UIScreen mainScreen] scale];
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 2.0f;
|
||||
transformAnimation.beginTime = beginTime - (i * transformAnimation.duration / 3.0f);;
|
||||
transformAnimation.keyTimes = @[@(0.0f), @(1.0f / 3.0f), @(2.0f / 3.0f), @(1.0)];
|
||||
|
||||
transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
|
||||
CATransform3D t1 = CATransform3DMakeTranslation(pointB.x - pointA.x, pointB.y - pointA.y, 0.0f);
|
||||
|
||||
CATransform3D t2 = CATransform3DMakeTranslation(pointC.x - pointA.x, pointC.y - pointA.y, 0.0f);
|
||||
|
||||
CATransform3D t3 = CATransform3DMakeTranslation(0.0f, 0.0f, 0.0f);
|
||||
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DIdentity],
|
||||
[NSValue valueWithCATransform3D:t1],
|
||||
[NSValue valueWithCATransform3D:t2],
|
||||
[NSValue valueWithCATransform3D:t3]];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorThreeDotsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 6/15/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorThreeDotsAnimation : NSObject<DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,59 @@
|
||||
//
|
||||
// DGActivityIndicatorThreeDotsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 6/15/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorThreeDotsAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorThreeDotsAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
NSTimeInterval duration = 0.5f;
|
||||
|
||||
CGFloat circleSize = size.width / 4.0f;
|
||||
CGFloat circlePadding = circleSize / 2.0f;
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - circleSize * 3 - circlePadding * 2) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - circleSize * 1) / 2.0f;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
|
||||
circle.frame = CGRectMake(oX + (circleSize + circlePadding) * (i % 3), oY, circleSize, circleSize);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.cornerRadius = circle.bounds.size.width / 2.0f;
|
||||
|
||||
CAKeyframeAnimation *tranformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
|
||||
tranformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5f, 0.5f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)]];
|
||||
|
||||
CAKeyframeAnimation *opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
|
||||
|
||||
opacityAnimation.values = @[@(0.25f), @(1.0f)];
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
animationGroup.autoreverses = YES;
|
||||
animationGroup.beginTime = beginTime;
|
||||
animationGroup.repeatCount = HUGE_VALF;
|
||||
animationGroup.duration = duration;
|
||||
animationGroup.animations = @[tranformAnimation, opacityAnimation];
|
||||
animationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:animationGroup forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorTriangleSkewSpinAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorTriangleSkewSpinAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,58 @@
|
||||
//
|
||||
// DGActivityIndicatorTriangleSkewSpinAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Nguyen Vinh on 7/20/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorTriangleSkewSpinAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorTriangleSkewSpinAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
CGFloat duration = 3.0f;
|
||||
CGFloat x = (layer.bounds.size.width - size.width) / 2;
|
||||
CGFloat y = (layer.bounds.size.height - size.height) / 2;
|
||||
CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.09f :0.57f :0.49f :0.9f];
|
||||
|
||||
// Rotation x animation
|
||||
CAKeyframeAnimation *rotationXAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.x"];
|
||||
|
||||
rotationXAnimation.duration = duration;
|
||||
rotationXAnimation.keyTimes = @[@0.0f, @0.25f, @0.5f, @0.75f, @1.0f];
|
||||
rotationXAnimation.values = @[@0.0f, @M_PI, @M_PI, @0.0f, @0.0f];
|
||||
rotationXAnimation.timingFunctions = @[timingFunction, timingFunction, timingFunction, timingFunction];
|
||||
|
||||
// Rotation x animation
|
||||
CAKeyframeAnimation *rotationYAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.y"];
|
||||
|
||||
rotationYAnimation.duration = duration;
|
||||
rotationYAnimation.keyTimes = @[@0.0f, @0.25f, @0.5f, @0.75f, @1.0f];
|
||||
rotationYAnimation.values = @[@0.0f, @0.0f, @M_PI, @M_PI, @0.0f];
|
||||
rotationYAnimation.timingFunctions = @[timingFunction, timingFunction, timingFunction, timingFunction];
|
||||
|
||||
// Animation
|
||||
CAAnimationGroup *animation = [CAAnimationGroup animation];
|
||||
|
||||
animation.animations = @[rotationXAnimation, rotationYAnimation];
|
||||
animation.duration = duration;
|
||||
animation.repeatCount = HUGE_VALF;
|
||||
|
||||
// Draw triangle
|
||||
CAShapeLayer *triangle = [CAShapeLayer layer];
|
||||
UIBezierPath *trianglePath = [UIBezierPath bezierPath];
|
||||
CGFloat offsetY = size.height / 4;
|
||||
|
||||
[trianglePath moveToPoint:CGPointMake(0, size.height - offsetY)];
|
||||
[trianglePath addLineToPoint:CGPointMake(size.width / 2, size.height / 2 - offsetY)];
|
||||
[trianglePath addLineToPoint:CGPointMake(size.width, size.height - offsetY)];
|
||||
[trianglePath closePath];
|
||||
triangle.fillColor = tintColor.CGColor;
|
||||
triangle.path = trianglePath.CGPath;
|
||||
[triangle addAnimation:animation forKey:@"animation"];
|
||||
triangle.frame = CGRectMake(x, y, size.width, size.height);
|
||||
[layer addSublayer:triangle];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorTriplePulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorTriplePulseAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,50 @@
|
||||
//
|
||||
// DGActivityIndicatorTriplePulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorTriplePulseAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorTriplePulseAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.height) / 2.0f;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
circle.frame = CGRectMake(oX, oY, size.width, size.height);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 0.8f;
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
|
||||
CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)];
|
||||
transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)];
|
||||
|
||||
CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
|
||||
opacityAnimation.fromValue = @(0.8f);
|
||||
opacityAnimation.toValue = @(0.0f);
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
animationGroup.beginTime = beginTime + i * 0.2f;
|
||||
animationGroup.repeatCount = HUGE_VALF;
|
||||
animationGroup.duration = 1.2f;
|
||||
animationGroup.animations = @[transformAnimation, opacityAnimation];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:animationGroup forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -0,0 +1,12 @@
|
||||
//
|
||||
// DGActivityIndicatorTripleRingsPulseAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/28.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorTripleRingsAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,55 @@
|
||||
//
|
||||
// DGActivityIndicatorTripleRingsPulseAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by tripleCC on 15/6/28.
|
||||
// Copyright (c) 2015年 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorTripleRingsAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorTripleRingsAnimation
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark DGActivityIndicatorAnimation Protocol
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0.0f, 0.0f, size.width, size.width)];
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - size.height) / 2.0f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CAShapeLayer *circle = [CAShapeLayer layer];
|
||||
circle.path = path.CGPath;
|
||||
circle.fillColor = [UIColor clearColor].CGColor;
|
||||
circle.strokeColor = tintColor.CGColor;
|
||||
circle.frame = CGRectMake(oX, oY, size.width, size.height);
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.opacity = 1.0f;
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
|
||||
CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.duration = 2.0f - i * 0.4f;
|
||||
transformAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1f, 0.1f, 0.0f)];
|
||||
transformAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)];
|
||||
transformAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
|
||||
|
||||
CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
|
||||
opacityAnimation.duration = transformAnimation.duration;
|
||||
opacityAnimation.fromValue = @(1.0f);
|
||||
opacityAnimation.toValue = @(0.8f);
|
||||
opacityAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
|
||||
|
||||
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
|
||||
animationGroup.removedOnCompletion = NO;
|
||||
animationGroup.beginTime = beginTime + i * 0.4f;
|
||||
animationGroup.repeatCount = HUGE_VALF;
|
||||
animationGroup.duration = 2.0f;
|
||||
animationGroup.animations = @[transformAnimation, opacityAnimation];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:animationGroup forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
@end
|
||||
@ -0,0 +1,13 @@
|
||||
//
|
||||
// DGActivityIndicatorTwoDotsAnimation.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/24/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
|
||||
@interface DGActivityIndicatorTwoDotsAnimation : NSObject <DGActivityIndicatorAnimationProtocol>
|
||||
|
||||
@end
|
||||
@ -0,0 +1,48 @@
|
||||
//
|
||||
// DGActivityIndicatorTwoDotsAnimation.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/24/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorTwoDotsAnimation.h"
|
||||
|
||||
@implementation DGActivityIndicatorTwoDotsAnimation
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor {
|
||||
NSTimeInterval beginTime = CACurrentMediaTime();
|
||||
|
||||
CGFloat circleSize = size.width * 0.92f;
|
||||
CGFloat oX = (layer.bounds.size.width - size.width) / 2.0f;
|
||||
CGFloat oY = (layer.bounds.size.height - circleSize) / 2.0f;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CALayer *circle = [CALayer layer];
|
||||
CGFloat offset = circleSize / 2.0f * i;
|
||||
circle.frame = CGRectMake((offset + size.width - circleSize) * i + oX, oY, circleSize, circleSize);
|
||||
circle.cornerRadius = circle.bounds.size.height / 2.0f;
|
||||
circle.anchorPoint = CGPointMake(0.5f, 0.5f);
|
||||
circle.transform = CATransform3DMakeScale(0.0f, 0.0f, 0.0f);
|
||||
circle.backgroundColor = tintColor.CGColor;
|
||||
|
||||
CAKeyframeAnimation *transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
|
||||
transformAnimation.removedOnCompletion = NO;
|
||||
transformAnimation.repeatCount = HUGE_VALF;
|
||||
transformAnimation.duration = 1.8f;
|
||||
transformAnimation.beginTime = beginTime - (transformAnimation.duration / 2.0f * i);
|
||||
transformAnimation.keyTimes = @[@(0.0), @(0.5), @(1.0)];
|
||||
|
||||
transformAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
|
||||
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
|
||||
transformAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0f, 1.0f, 0.0f)],
|
||||
[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0f, 0.0f, 0.0f)]];
|
||||
|
||||
[layer addSublayer:circle];
|
||||
[circle addAnimation:transformAnimation forKey:@"animation"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
16
Example/Pods/DGActivityIndicatorView/DGActivityIndicatorView/DGActivityIndicatorAnimationProtocol.h
generated
Normal file
16
Example/Pods/DGActivityIndicatorView/DGActivityIndicatorView/DGActivityIndicatorAnimationProtocol.h
generated
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// DGActivityIndicatorAnimationProtocol.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol DGActivityIndicatorAnimationProtocol <NSObject>
|
||||
|
||||
- (void)setupAnimationInLayer:(CALayer *)layer withSize:(CGSize)size tintColor:(UIColor *)tintColor;
|
||||
|
||||
@end
|
||||
62
Example/Pods/DGActivityIndicatorView/DGActivityIndicatorView/DGActivityIndicatorView.h
generated
Normal file
62
Example/Pods/DGActivityIndicatorView/DGActivityIndicatorView/DGActivityIndicatorView.h
generated
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// DGActivityIndicatorView.h
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, DGActivityIndicatorAnimationType) {
|
||||
DGActivityIndicatorAnimationTypeNineDots,
|
||||
DGActivityIndicatorAnimationTypeTriplePulse,
|
||||
DGActivityIndicatorAnimationTypeFiveDots,
|
||||
DGActivityIndicatorAnimationTypeRotatingSquares,
|
||||
DGActivityIndicatorAnimationTypeDoubleBounce,
|
||||
DGActivityIndicatorAnimationTypeTwoDots,
|
||||
DGActivityIndicatorAnimationTypeThreeDots,
|
||||
DGActivityIndicatorAnimationTypeBallPulse,
|
||||
DGActivityIndicatorAnimationTypeBallClipRotate,
|
||||
DGActivityIndicatorAnimationTypeBallClipRotatePulse,
|
||||
DGActivityIndicatorAnimationTypeBallClipRotateMultiple,
|
||||
DGActivityIndicatorAnimationTypeBallRotate,
|
||||
DGActivityIndicatorAnimationTypeBallZigZag,
|
||||
DGActivityIndicatorAnimationTypeBallZigZagDeflect,
|
||||
DGActivityIndicatorAnimationTypeBallTrianglePath,
|
||||
DGActivityIndicatorAnimationTypeBallScale,
|
||||
DGActivityIndicatorAnimationTypeLineScale,
|
||||
DGActivityIndicatorAnimationTypeLineScaleParty,
|
||||
DGActivityIndicatorAnimationTypeBallScaleMultiple,
|
||||
DGActivityIndicatorAnimationTypeBallPulseSync,
|
||||
DGActivityIndicatorAnimationTypeBallBeat,
|
||||
DGActivityIndicatorAnimationTypeLineScalePulseOut,
|
||||
DGActivityIndicatorAnimationTypeLineScalePulseOutRapid,
|
||||
DGActivityIndicatorAnimationTypeBallScaleRipple,
|
||||
DGActivityIndicatorAnimationTypeBallScaleRippleMultiple,
|
||||
DGActivityIndicatorAnimationTypeTriangleSkewSpin,
|
||||
DGActivityIndicatorAnimationTypeBallGridBeat,
|
||||
DGActivityIndicatorAnimationTypeBallGridPulse,
|
||||
DGActivityIndicatorAnimationTypeRotatingSandglass,
|
||||
DGActivityIndicatorAnimationTypeRotatingTrigons,
|
||||
DGActivityIndicatorAnimationTypeTripleRings,
|
||||
DGActivityIndicatorAnimationTypeCookieTerminator,
|
||||
DGActivityIndicatorAnimationTypeBallSpinFadeLoader
|
||||
};
|
||||
|
||||
@interface DGActivityIndicatorView : UIView
|
||||
|
||||
- (id)initWithType:(DGActivityIndicatorAnimationType)type;
|
||||
- (id)initWithType:(DGActivityIndicatorAnimationType)type tintColor:(UIColor *)tintColor;
|
||||
- (id)initWithType:(DGActivityIndicatorAnimationType)type tintColor:(UIColor *)tintColor size:(CGFloat)size;
|
||||
|
||||
@property (nonatomic) DGActivityIndicatorAnimationType type;
|
||||
@property (nonatomic, strong) UIColor *tintColor;
|
||||
@property (nonatomic) CGFloat size;
|
||||
|
||||
@property (nonatomic, readonly) BOOL animating;
|
||||
|
||||
- (void)startAnimating;
|
||||
- (void)stopAnimating;
|
||||
|
||||
@end
|
||||
201
Example/Pods/DGActivityIndicatorView/DGActivityIndicatorView/DGActivityIndicatorView.m
generated
Normal file
201
Example/Pods/DGActivityIndicatorView/DGActivityIndicatorView/DGActivityIndicatorView.m
generated
Normal file
@ -0,0 +1,201 @@
|
||||
//
|
||||
// DGActivityIndicatorView.m
|
||||
// DGActivityIndicatorExample
|
||||
//
|
||||
// Created by Danil Gontovnik on 5/23/15.
|
||||
// Copyright (c) 2015 Danil Gontovnik. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DGActivityIndicatorView.h"
|
||||
|
||||
#import "DGActivityIndicatorNineDotsAnimation.h"
|
||||
#import "DGActivityIndicatorTriplePulseAnimation.h"
|
||||
#import "DGActivityIndicatorFiveDotsAnimation.h"
|
||||
#import "DGActivityIndicatorRotatingSquaresAnimation.h"
|
||||
#import "DGActivityIndicatorDoubleBounceAnimation.h"
|
||||
#import "DGActivityIndicatorTwoDotsAnimation.h"
|
||||
#import "DGActivityIndicatorThreeDotsAnimation.h"
|
||||
#import "DGActivityIndicatorBallPulseAnimation.h"
|
||||
#import "DGActivityIndicatorBallClipRotateAnimation.h"
|
||||
#import "DGActivityIndicatorBallClipRotatePulseAnimation.h"
|
||||
#import "DGActivityIndicatorBallClipRotateMultipleAnimation.h"
|
||||
#import "DGActivityIndicatorBallRotateAnimation.h"
|
||||
#import "DGActivityIndicatorBallZigZagAnimation.h"
|
||||
#import "DGActivityIndicatorBallZigZagDeflectAnimation.h"
|
||||
#import "DGActivityIndicatorBallTrianglePathAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleAnimation.h"
|
||||
#import "DGActivityIndicatorLineScaleAnimation.h"
|
||||
#import "DGActivityIndicatorLineScalePartyAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleMultipleAnimation.h"
|
||||
#import "DGActivityIndicatorBallPulseSyncAnimation.h"
|
||||
#import "DGActivityIndicatorBallBeatAnimation.h"
|
||||
#import "DGActivityIndicatorLineScalePulseOutAnimation.h"
|
||||
#import "DGActivityIndicatorLineScalePulseOutRapidAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleRippleAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleRippleMultipleAnimation.h"
|
||||
#import "DGActivityIndicatorTriangleSkewSpinAnimation.h"
|
||||
#import "DGActivityIndicatorBallGridBeatAnimation.h"
|
||||
#import "DGActivityIndicatorBallGridPulseAnimation.h"
|
||||
#import "DGActivityIndicatorRotatingSandglassAnimation.h"
|
||||
#import "DGActivityIndicatorRotatingTrigonAnimation.h"
|
||||
#import "DGActivityIndicatorTripleRingsAnimation.h"
|
||||
#import "DGActivityIndicatorCookieTerminatorAnimation.h"
|
||||
#import "DGActivityIndicatorBallSpinFadeLoader.h"
|
||||
|
||||
static const CGFloat kDGActivityIndicatorDefaultSize = 40.0f;
|
||||
|
||||
@implementation DGActivityIndicatorView
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Constructors
|
||||
|
||||
- (id)initWithType:(DGActivityIndicatorAnimationType)type {
|
||||
return [self initWithType:type tintColor:[UIColor whiteColor] size:kDGActivityIndicatorDefaultSize];
|
||||
}
|
||||
|
||||
- (id)initWithType:(DGActivityIndicatorAnimationType)type tintColor:(UIColor *)tintColor {
|
||||
return [self initWithType:type tintColor:tintColor size:kDGActivityIndicatorDefaultSize];
|
||||
}
|
||||
|
||||
- (id)initWithType:(DGActivityIndicatorAnimationType)type tintColor:(UIColor *)tintColor size:(CGFloat)size {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_type = type;
|
||||
_size = size;
|
||||
_tintColor = tintColor;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Methods
|
||||
|
||||
- (void)setupAnimation {
|
||||
self.layer.sublayers = nil;
|
||||
|
||||
id<DGActivityIndicatorAnimationProtocol> animation = [DGActivityIndicatorView activityIndicatorAnimationForAnimationType:_type];
|
||||
|
||||
if ([animation respondsToSelector:@selector(setupAnimationInLayer:withSize:tintColor:)]) {
|
||||
[animation setupAnimationInLayer:self.layer withSize:CGSizeMake(_size, _size) tintColor:_tintColor];
|
||||
self.layer.speed = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)startAnimating {
|
||||
if (!self.layer.sublayers) {
|
||||
[self setupAnimation];
|
||||
}
|
||||
self.layer.speed = 1.0f;
|
||||
_animating = YES;
|
||||
}
|
||||
|
||||
- (void)stopAnimating {
|
||||
self.layer.speed = 0.0f;
|
||||
_animating = NO;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Setters
|
||||
|
||||
- (void)setType:(DGActivityIndicatorAnimationType)type {
|
||||
if (_type != type) {
|
||||
_type = type;
|
||||
|
||||
[self setupAnimation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSize:(CGFloat)size {
|
||||
if (_size != size) {
|
||||
_size = size;
|
||||
|
||||
[self setupAnimation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTintColor:(UIColor *)tintColor {
|
||||
if (![_tintColor isEqual:tintColor]) {
|
||||
_tintColor = tintColor;
|
||||
|
||||
for (CALayer *sublayer in self.layer.sublayers) {
|
||||
sublayer.backgroundColor = tintColor.CGColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Getters
|
||||
|
||||
+ (id<DGActivityIndicatorAnimationProtocol>)activityIndicatorAnimationForAnimationType:(DGActivityIndicatorAnimationType)type {
|
||||
switch (type) {
|
||||
case DGActivityIndicatorAnimationTypeNineDots:
|
||||
return [[DGActivityIndicatorNineDotsAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeTriplePulse:
|
||||
return [[DGActivityIndicatorTriplePulseAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeFiveDots:
|
||||
return [[DGActivityIndicatorFiveDotsAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeRotatingSquares:
|
||||
return [[DGActivityIndicatorRotatingSquaresAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeDoubleBounce:
|
||||
return [[DGActivityIndicatorDoubleBounceAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeTwoDots:
|
||||
return [[DGActivityIndicatorTwoDotsAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeThreeDots:
|
||||
return [[DGActivityIndicatorThreeDotsAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallPulse:
|
||||
return [[DGActivityIndicatorBallPulseAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallClipRotate:
|
||||
return [[DGActivityIndicatorBallClipRotateAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallClipRotatePulse:
|
||||
return [[DGActivityIndicatorBallClipRotatePulseAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallClipRotateMultiple:
|
||||
return [[DGActivityIndicatorBallClipRotateMultipleAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallRotate:
|
||||
return [[DGActivityIndicatorBallRotateAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallZigZag:
|
||||
return [[DGActivityIndicatorBallZigZagAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallZigZagDeflect:
|
||||
return [[DGActivityIndicatorBallZigZagDeflectAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallTrianglePath:
|
||||
return [[DGActivityIndicatorBallTrianglePathAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallScale:
|
||||
return [[DGActivityIndicatorBallScaleAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeLineScale:
|
||||
return [[DGActivityIndicatorLineScaleAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeLineScaleParty:
|
||||
return [[DGActivityIndicatorLineScalePartyAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallScaleMultiple:
|
||||
return [[DGActivityIndicatorBallScaleMultipleAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallPulseSync:
|
||||
return [[DGActivityIndicatorBallPulseSyncAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallBeat:
|
||||
return [[DGActivityIndicatorBallBeatAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeLineScalePulseOut:
|
||||
return [[DGActivityIndicatorLineScalePulseOutAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeLineScalePulseOutRapid:
|
||||
return [[DGActivityIndicatorLineScalePulseOutRapidAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallScaleRipple:
|
||||
return [[DGActivityIndicatorBallScaleRippleAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallScaleRippleMultiple:
|
||||
return [[DGActivityIndicatorBallScaleRippleMultipleAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeTriangleSkewSpin:
|
||||
return [[DGActivityIndicatorTriangleSkewSpinAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallGridBeat:
|
||||
return [[DGActivityIndicatorBallGridBeatAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeBallGridPulse:
|
||||
return [[DGActivityIndicatorBallGridPulseAnimation alloc] init];
|
||||
case DGActivityIndicatorAnimationTypeRotatingSandglass:
|
||||
return [[DGActivityIndicatorRotatingSandglassAnimation alloc]init];
|
||||
case DGActivityIndicatorAnimationTypeRotatingTrigons:
|
||||
return [[DGActivityIndicatorRotatingTrigonAnimation alloc]init];
|
||||
case DGActivityIndicatorAnimationTypeTripleRings:
|
||||
return [[DGActivityIndicatorTripleRingsAnimation alloc]init];
|
||||
case DGActivityIndicatorAnimationTypeCookieTerminator:
|
||||
return [[DGActivityIndicatorCookieTerminatorAnimation alloc]init];
|
||||
case DGActivityIndicatorAnimationTypeBallSpinFadeLoader:
|
||||
return [[DGActivityIndicatorBallSpinFadeLoader alloc] init];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
22
Example/Pods/DGActivityIndicatorView/LICENSE
generated
Normal file
22
Example/Pods/DGActivityIndicatorView/LICENSE
generated
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Danil Gontovnik
|
||||
|
||||
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.
|
||||
|
||||
87
Example/Pods/DGActivityIndicatorView/README.md
generated
Normal file
87
Example/Pods/DGActivityIndicatorView/README.md
generated
Normal file
@ -0,0 +1,87 @@
|
||||
# DGActivityIndicatorView
|
||||
DGActivityIndicatorView is a great way to make loading spinners in your application look nicer. It contains 32 different indicator view styles. Inspired by: http://connoratherton.com/loaders
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
* Xcode 6 or higher
|
||||
* Apple LLVM compiler
|
||||
* iOS 8.0 or higher (May work on previous versions, just did not testit. Feel free to edit it).
|
||||
* ARC
|
||||
|
||||
## Demo
|
||||
|
||||
Open and run the DGActivityIndicatorExample project in Xcode to see DGActivityIndicatorView in action.
|
||||
|
||||
## Installation
|
||||
|
||||
### Cocoapods
|
||||
|
||||
Install Cocoapods if it is not installed yet:
|
||||
|
||||
``` bash
|
||||
$ [sudo] gem install cocoapods
|
||||
$ pod setup
|
||||
```
|
||||
|
||||
Add DGActivityIndicatorView to Podfile:
|
||||
|
||||
``` bash
|
||||
pod 'DGActivityIndicatorView'
|
||||
```
|
||||
|
||||
Call 'pod install':
|
||||
|
||||
``` bash
|
||||
pod install
|
||||
```
|
||||
|
||||
### Manual install
|
||||
|
||||
All you need to do is drop DGActivityIndicatorView folder into your project and include headers.
|
||||
|
||||
## Example usage
|
||||
|
||||
``` objective-c
|
||||
DGActivityIndicatorView *activityIndicatorView = [[DGActivityIndicatorView alloc] initWithType:DGActivityIndicatorAnimationTypeDoubleBounce tintColor:[UIColor whiteColor] size:20.0f];
|
||||
activityIndicatorView.frame = CGRectMake(0.0f, 0.0f, 50.0f, 50.0f);
|
||||
[self.view addSubview:activityIndicatorView];
|
||||
[activityIndicatorView startAnimating];
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
||||
* Add more different animations
|
||||
|
||||
## Contact
|
||||
|
||||
Danil Gontovnik
|
||||
|
||||
- https://github.com/gontovnik
|
||||
- https://twitter.com/gontovnik
|
||||
- http://gontovnik.com/
|
||||
- gontovnik.danil@gmail.com
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Danil Gontovnik
|
||||
|
||||
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.
|
||||
@ -28,6 +28,9 @@
|
||||
"dependencies": {
|
||||
"PureLayout": [
|
||||
|
||||
],
|
||||
"DGActivityIndicatorView": [
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
5
Example/Pods/Manifest.lock
generated
5
Example/Pods/Manifest.lock
generated
@ -1,4 +1,5 @@
|
||||
PODS:
|
||||
- DGActivityIndicatorView (2.0)
|
||||
- Expecta (1.0.5)
|
||||
- Expecta+Snapshots (2.0.0):
|
||||
- Expecta (~> 1.0)
|
||||
@ -9,6 +10,7 @@ PODS:
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.7):
|
||||
- FBSnapshotTestCase/Core
|
||||
- PNImagePickerViewController (0.1.0):
|
||||
- DGActivityIndicatorView
|
||||
- PureLayout
|
||||
- PureLayout (3.0.1)
|
||||
- Specta (1.0.5)
|
||||
@ -26,10 +28,11 @@ EXTERNAL SOURCES:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
DGActivityIndicatorView: 52875b025a6ccf6a431a905285c12e2bb95eb559
|
||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
|
||||
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
|
||||
PNImagePickerViewController: 9eaf2575e70de776463e23904f9d466f98d27ad4
|
||||
PNImagePickerViewController: 8225ee425aa04f1f3716c7ea9786561de3782096
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
|
||||
|
||||
2667
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
2667
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
||||
buildForArchiving = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = 'primary'
|
||||
BlueprintIdentifier = 'FE84737BD4D109801238DAB5722D7DA1'
|
||||
BlueprintIdentifier = '7F1E45BB1F97A2978AEC44A8621A23FC'
|
||||
BlueprintName = 'PNImagePickerViewController'
|
||||
ReferencedContainer = 'container:Pods.xcodeproj'
|
||||
BuildableName = 'PNImagePickerViewController.framework'>
|
||||
|
||||
5
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView-dummy.m
generated
Normal file
5
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView-dummy.m
generated
Normal file
@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_DGActivityIndicatorView : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_DGActivityIndicatorView
|
||||
@end
|
||||
4
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView-prefix.pch
generated
Normal file
4
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView-prefix.pch
generated
Normal file
@ -0,0 +1,4 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
41
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView-umbrella.h
generated
Normal file
41
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView-umbrella.h
generated
Normal file
@ -0,0 +1,41 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "DGActivityIndicatorBallBeatAnimation.h"
|
||||
#import "DGActivityIndicatorBallClipRotateAnimation.h"
|
||||
#import "DGActivityIndicatorBallClipRotateMultipleAnimation.h"
|
||||
#import "DGActivityIndicatorBallClipRotatePulseAnimation.h"
|
||||
#import "DGActivityIndicatorBallGridBeatAnimation.h"
|
||||
#import "DGActivityIndicatorBallGridPulseAnimation.h"
|
||||
#import "DGActivityIndicatorBallPulseAnimation.h"
|
||||
#import "DGActivityIndicatorBallPulseSyncAnimation.h"
|
||||
#import "DGActivityIndicatorBallRotateAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleMultipleAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleRippleAnimation.h"
|
||||
#import "DGActivityIndicatorBallScaleRippleMultipleAnimation.h"
|
||||
#import "DGActivityIndicatorBallSpinFadeLoader.h"
|
||||
#import "DGActivityIndicatorBallTrianglePathAnimation.h"
|
||||
#import "DGActivityIndicatorBallZigZagAnimation.h"
|
||||
#import "DGActivityIndicatorBallZigZagDeflectAnimation.h"
|
||||
#import "DGActivityIndicatorCookieTerminatorAnimation.h"
|
||||
#import "DGActivityIndicatorDoubleBounceAnimation.h"
|
||||
#import "DGActivityIndicatorFiveDotsAnimation.h"
|
||||
#import "DGActivityIndicatorLineScaleAnimation.h"
|
||||
#import "DGActivityIndicatorLineScalePartyAnimation.h"
|
||||
#import "DGActivityIndicatorLineScalePulseOutAnimation.h"
|
||||
#import "DGActivityIndicatorLineScalePulseOutRapidAnimation.h"
|
||||
#import "DGActivityIndicatorNineDotsAnimation.h"
|
||||
#import "DGActivityIndicatorRotatingSandglassAnimation.h"
|
||||
#import "DGActivityIndicatorRotatingSquaresAnimation.h"
|
||||
#import "DGActivityIndicatorRotatingTrigonAnimation.h"
|
||||
#import "DGActivityIndicatorThreeDotsAnimation.h"
|
||||
#import "DGActivityIndicatorTriangleSkewSpinAnimation.h"
|
||||
#import "DGActivityIndicatorTriplePulseAnimation.h"
|
||||
#import "DGActivityIndicatorTripleRingsAnimation.h"
|
||||
#import "DGActivityIndicatorTwoDotsAnimation.h"
|
||||
#import "DGActivityIndicatorAnimationProtocol.h"
|
||||
#import "DGActivityIndicatorView.h"
|
||||
|
||||
FOUNDATION_EXPORT double DGActivityIndicatorViewVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char DGActivityIndicatorViewVersionString[];
|
||||
|
||||
6
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView.modulemap
generated
Normal file
6
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView.modulemap
generated
Normal file
@ -0,0 +1,6 @@
|
||||
framework module DGActivityIndicatorView {
|
||||
umbrella header "DGActivityIndicatorView-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
6
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView.xcconfig
generated
Normal file
6
Example/Pods/Target Support Files/DGActivityIndicatorView/DGActivityIndicatorView.xcconfig
generated
Normal file
@ -0,0 +1,6 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit"
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
26
Example/Pods/Target Support Files/DGActivityIndicatorView/Info.plist
generated
Normal file
26
Example/Pods/Target Support Files/DGActivityIndicatorView/Info.plist
generated
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -1,6 +1,32 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## DGActivityIndicatorView
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Danil Gontovnik
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
## PNImagePickerViewController
|
||||
|
||||
Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -12,6 +12,36 @@
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Danil Gontovnik
|
||||
|
||||
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.
|
||||
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>DGActivityIndicatorView</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -84,10 +84,12 @@ strip_invalid_archs() {
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "Pods-PNImagePickerViewController_Example/DGActivityIndicatorView.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Example/PNImagePickerViewController.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Example/PureLayout.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "Pods-PNImagePickerViewController_Example/DGActivityIndicatorView.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Example/PNImagePickerViewController.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Example/PureLayout.framework"
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "PNImagePickerViewController" -framework "PureLayout"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/DGActivityIndicatorView.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DGActivityIndicatorView" -framework "PNImagePickerViewController" -framework "PureLayout"
|
||||
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNImagePickerViewController_Example"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "PNImagePickerViewController" -framework "PureLayout"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/DGActivityIndicatorView.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DGActivityIndicatorView" -framework "PNImagePickerViewController" -framework "PureLayout"
|
||||
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNImagePickerViewController_Example"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,6 +1,32 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## DGActivityIndicatorView
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Danil Gontovnik
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
## PNImagePickerViewController
|
||||
|
||||
Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -12,6 +12,36 @@
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Danil Gontovnik
|
||||
|
||||
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.
|
||||
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>DGActivityIndicatorView</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -84,6 +84,7 @@ strip_invalid_archs() {
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/DGActivityIndicatorView.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/PNImagePickerViewController.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/PureLayout.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/Expecta.framework"
|
||||
@ -92,6 +93,7 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/Specta.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/DGActivityIndicatorView.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/PNImagePickerViewController.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/PureLayout.framework"
|
||||
install_framework "Pods-PNImagePickerViewController_Tests/Expecta.framework"
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "PNImagePickerViewController" -framework "PureLayout" -framework "Specta"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/DGActivityIndicatorView.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DGActivityIndicatorView" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "PNImagePickerViewController" -framework "PureLayout" -framework "Specta"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNImagePickerViewController_Tests"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "PNImagePickerViewController" -framework "PureLayout" -framework "Specta"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/DGActivityIndicatorView.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNImagePickerViewController.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "DGActivityIndicatorView" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "PNImagePickerViewController" -framework "PureLayout" -framework "Specta"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNImagePickerViewController_Tests"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "PNImagePickerViewController"
|
||||
s.version = "0.1.0"
|
||||
s.summary = "PNImagePickerViewController is a fork of jacobsieradzki/JSImagePickerController with iOS8+ PhotoKit support."
|
||||
s.summary = "PNImagePickerViewController is a fork of jacobsieradzki/JSImagePickerController with iOS8+ PhotoKit support."
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
# * Think: What does it do? Why did you write it? What is the focus?
|
||||
@ -18,11 +18,11 @@ s.summary = "PNImagePickerViewController is a fork of jacobsieradzki/JS
|
||||
# * Finally, don't worry about the indent, CocoaPods strips it!
|
||||
# s.description = <<-DESC DESC
|
||||
|
||||
s.homepage = "https://github.com/<GITHUB_USERNAME>/PNImagePickerViewController"
|
||||
s.homepage = "https://github.com/giuseppenucifora/PNImagePickerViewController"
|
||||
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Giuseppe Nucifora" => "me@giuseppenucifora.com" }
|
||||
s.source = { :git => "https://github.com/<GITHUB_USERNAME>/PNImagePickerViewController.git", :tag => s.version.to_s }
|
||||
s.source = { :git => "https://github.com/giuseppenucifora/PNImagePickerViewController.git", :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
|
||||
s.platform = :ios, '7.0'
|
||||
@ -36,4 +36,5 @@ s.summary = "PNImagePickerViewController is a fork of jacobsieradzki/JS
|
||||
# s.public_header_files = 'Pod/Classes/**/*.h'
|
||||
s.frameworks = 'Photos', 'PhotosUI'
|
||||
s.dependency 'PureLayout'
|
||||
s.dependency 'DGActivityIndicatorView'
|
||||
end
|
||||
|
||||
@ -8,10 +8,12 @@
|
||||
|
||||
#import "PNCollectionViewCell.h"
|
||||
#import <PureLayout/PureLayout.h>
|
||||
#import <MMMaterialDesignSpinner/MMMaterialDesignSpinner.h>
|
||||
|
||||
@interface PNCollectionViewCell()
|
||||
|
||||
@property (nonatomic, strong) UIImageView *photoImageView;
|
||||
@property (nonatomic, strong) MMMaterialDesignSpinner *loadingSpinner;
|
||||
|
||||
@end
|
||||
|
||||
@ -21,20 +23,6 @@
|
||||
return [NSStringFromClass([self class]) stringByAppendingString:@"Identifier"];
|
||||
}
|
||||
|
||||
- (instancetype) init {
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
[self.contentView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
|
||||
_photoImageView = [UIImageView newAutoLayoutView];
|
||||
[_photoImageView setContentMode:UIViewContentModeScaleAspectFill];
|
||||
|
||||
[self.contentView addSubview:_photoImageView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype) initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
@ -42,8 +30,12 @@
|
||||
|
||||
_photoImageView = [UIImageView newAutoLayoutView];
|
||||
[_photoImageView setContentMode:UIViewContentModeScaleAspectFill];
|
||||
[_photoImageView.layer setCornerRadius:4];
|
||||
[_photoImageView.layer setMasksToBounds:YES];
|
||||
|
||||
[self.contentView addSubview:_photoImageView];
|
||||
|
||||
_loadingSpinner = [MMMaterialDesignSpinner newAutoLayoutView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -56,13 +48,12 @@
|
||||
|
||||
self.didUpdateConstraints = YES;
|
||||
|
||||
|
||||
[self.contentView autoPinEdgesToSuperviewEdges];
|
||||
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:5];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:5];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:8];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:8];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:8];
|
||||
[_photoImageView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:8];
|
||||
[_photoImageView autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_photoImageView autoAlignAxisToSuperviewAxis:ALAxisHorizontal];
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
|
||||
- (void)imagePicker:(PNImagePickerViewController *)imagePicker didSelectImage:(UIImage *)image;
|
||||
|
||||
- (void)imagePicker:(PNImagePickerViewController *)imagePicker donwloadImageWithProgress:(double )progress;
|
||||
|
||||
@optional
|
||||
|
||||
- (void)imagePicker:(PNImagePickerViewController *)imagePicker donwloadImageWithProgress:(double )progress;
|
||||
|
||||
- (void)imagePickerDidOpen;
|
||||
|
||||
- (void)imagePickerWillOpen;
|
||||
@ -63,17 +63,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@interface TransitionDelegate : NSObject <UIViewControllerTransitioningDelegate>
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@interface AnimatedTransitioning : NSObject <UIViewControllerAnimatedTransitioning>
|
||||
|
||||
@property (nonatomic, assign) BOOL isPresenting;
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#import <MobileCoreServices/UTCoreTypes.h>
|
||||
#import "PNCollectionViewCell.h"
|
||||
#import "NSString+HexColor.h"
|
||||
#import <PureLayout/PureLayout.h>
|
||||
|
||||
|
||||
#pragma mark - PNImagePickerViewController -
|
||||
@ -25,18 +26,21 @@
|
||||
@property (nonatomic) NSTimeInterval animationTime;
|
||||
|
||||
@property (nonatomic, strong) UIViewController *targetController;
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
|
||||
@property (nonatomic, strong) UIView *backgroundView;
|
||||
@property (nonatomic, strong) UIView *imagePickerView;
|
||||
@property (nonatomic, strong) UIView *separator1;
|
||||
@property (nonatomic, strong) UIView *separator2;
|
||||
@property (nonatomic, strong) UIView *separator3;
|
||||
|
||||
@property (nonatomic) CGRect imagePickerFrame;
|
||||
@property (nonatomic) CGRect hiddenFrame;
|
||||
@property (nonatomic, strong) NSLayoutConstraint *hideConstraint;
|
||||
|
||||
@property (nonatomic) TransitionDelegate *transitionController;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *assets;
|
||||
|
||||
@property (nonatomic, assign) BOOL didUpdateConstraints;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PNImagePickerViewController
|
||||
@ -47,110 +51,179 @@
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.assets = [[NSMutableArray alloc] init];
|
||||
_assets = [[NSMutableArray alloc] init];
|
||||
_targetSize = CGSizeMake(1024, 1024);
|
||||
[self setupView];
|
||||
_haveCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
|
||||
_animationTime = 0.4;
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setupView {
|
||||
- (void) viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
self.window = [UIApplication sharedApplication].keyWindow;
|
||||
|
||||
self.haveCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
|
||||
CGFloat localImagePickerHeight = imagePickerHeight;
|
||||
if (!self.haveCamera) {
|
||||
localImagePickerHeight -= 47.0f;
|
||||
}
|
||||
self.imagePickerFrame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height-localImagePickerHeight, [UIScreen mainScreen].bounds.size.width, localImagePickerHeight);
|
||||
self.hiddenFrame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width, localImagePickerHeight);
|
||||
self.imagePickerView = [[UIView alloc] initWithFrame:self.hiddenFrame];
|
||||
self.imagePickerView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
|
||||
_imagePickerView = [UIView newAutoLayoutView];
|
||||
[_imagePickerView setBackgroundColor:[UIColor whiteColor]];
|
||||
|
||||
self.backgroundView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
self.backgroundView.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.7];
|
||||
self.backgroundView.alpha = 0;
|
||||
_backgroundView = [UIView newAutoLayoutView];
|
||||
_backgroundView.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.7];
|
||||
_backgroundView.alpha = 0;
|
||||
UITapGestureRecognizer *dismissTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)];
|
||||
self.backgroundView.userInteractionEnabled = YES;
|
||||
[self.backgroundView addGestureRecognizer:dismissTap];
|
||||
_backgroundView.userInteractionEnabled = YES;
|
||||
[_backgroundView addGestureRecognizer:dismissTap];
|
||||
|
||||
[self.view addSubview:_backgroundView];
|
||||
|
||||
|
||||
self.animationTime = 0.2;
|
||||
|
||||
[self.window addSubview:self.backgroundView];
|
||||
[self.window addSubview:self.imagePickerView];
|
||||
|
||||
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.imagePickerView.frame.size.width, 50)];
|
||||
[btn setTitle:@"Hello!" forState:UIControlStateNormal];
|
||||
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
|
||||
[btn addTarget:self action:@selector(setDefaults) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
[self.imagePickerView addSubview:btn];
|
||||
|
||||
[self imagePickerViewSetup];
|
||||
[self getCameraRollImages];
|
||||
}
|
||||
|
||||
- (void)imagePickerViewSetup {
|
||||
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
|
||||
|
||||
const CGRect collectionViewFrame = CGRectMake(7, 8, screenWidth-7-7, 122);
|
||||
const CGRect libraryBtnFrame = CGRectMake(0, 149, screenWidth, 30);
|
||||
const CGRect cameraBtnFrame = CGRectMake(0, self.haveCamera ? 196 : 0, screenWidth, 30);
|
||||
const CGRect cancelBtnFrame = CGRectMake(0, self.haveCamera ? 242 : 196, screenWidth, 30);
|
||||
|
||||
UICollectionViewFlowLayout *aFlowLayout = [[UICollectionViewFlowLayout alloc] init];
|
||||
[aFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:collectionViewFrame collectionViewLayout:aFlowLayout];
|
||||
[self.collectionView setBackgroundColor:[UIColor whiteColor]];
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.showsVerticalScrollIndicator = NO;
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
[self.collectionView registerClass:[PNCollectionViewCell class] forCellWithReuseIdentifier:[PNCollectionViewCell cellIdentifier]];
|
||||
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) collectionViewLayout:aFlowLayout];
|
||||
[_collectionView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[_collectionView setBackgroundColor:[UIColor whiteColor]];
|
||||
_collectionView.showsHorizontalScrollIndicator = NO;
|
||||
_collectionView.showsVerticalScrollIndicator = NO;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
[_collectionView registerClass:[PNCollectionViewCell class] forCellWithReuseIdentifier:[PNCollectionViewCell cellIdentifier]];
|
||||
|
||||
UIFont *btnFont = [UIFont systemFontOfSize:19.0];
|
||||
|
||||
self.photoLibraryBtn = [[UIButton alloc] initWithFrame:libraryBtnFrame];
|
||||
[self.photoLibraryBtn setTitle:@"Photo Library" forState:UIControlStateNormal];
|
||||
self.photoLibraryBtn.titleLabel.font = btnFont;
|
||||
[self.photoLibraryBtn addTarget:self action:@selector(selectFromLibraryWasPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
_photoLibraryBtn = [UIButton newAutoLayoutView];
|
||||
[_photoLibraryBtn setTitle:NSLocalizedString(@"Photo Library",@"") forState:UIControlStateNormal];
|
||||
_photoLibraryBtn.titleLabel.font = btnFont;
|
||||
[_photoLibraryBtn addTarget:self action:@selector(selectFromLibraryWasPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_photoLibraryBtn setTitleColor:[@"0b60fe" colorFromHex] forState:UIControlStateNormal];
|
||||
[_photoLibraryBtn setTitleColor:[@"70b3fd" colorFromHex] forState:UIControlStateHighlighted];
|
||||
|
||||
self.cameraBtn = [[UIButton alloc] initWithFrame:cameraBtnFrame];
|
||||
[self.cameraBtn setTitle:@"Take Photo" forState:UIControlStateNormal];
|
||||
self.cameraBtn.titleLabel.font = btnFont;
|
||||
[self.cameraBtn addTarget:self action:@selector(takePhotoWasPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.cameraBtn.hidden = !self.haveCamera;
|
||||
_cancelBtn = [UIButton newAutoLayoutView];
|
||||
[_cancelBtn setTitle:NSLocalizedString(@"Cancel",@"") forState:UIControlStateNormal];
|
||||
_cancelBtn.titleLabel.font = btnFont;
|
||||
[_cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_cancelBtn setTitleColor:[@"0b60fe" colorFromHex] forState:UIControlStateNormal];
|
||||
[_cancelBtn setTitleColor:[@"70b3fd" colorFromHex] forState:UIControlStateHighlighted];
|
||||
|
||||
self.cancelBtn = [[UIButton alloc] initWithFrame:cancelBtnFrame];
|
||||
[self.cancelBtn setTitle:@"Cancel" forState:UIControlStateNormal];
|
||||
self.cancelBtn.titleLabel.font = btnFont;
|
||||
[self.cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
for (UIButton *btn in @[self.photoLibraryBtn, self.cameraBtn, self.cancelBtn]) {
|
||||
[btn setTitleColor:[@"0b60fe" colorFromHex] forState:UIControlStateNormal];
|
||||
[btn setTitleColor:[@"70b3fd" colorFromHex] forState:UIControlStateHighlighted];
|
||||
|
||||
_separator2 = [UIView newAutoLayoutView];
|
||||
_separator2.backgroundColor = [@"cacaca" colorFromHex];
|
||||
[_imagePickerView addSubview:_separator2];
|
||||
|
||||
_separator3 = [UIView newAutoLayoutView];
|
||||
_separator3.backgroundColor = [@"cacaca" colorFromHex];
|
||||
[_imagePickerView addSubview:_separator3];
|
||||
|
||||
if(_haveCamera) {
|
||||
_cameraBtn = [UIButton newAutoLayoutView];
|
||||
[_cameraBtn setTitle:NSLocalizedString(@"Take Photo",@"") forState:UIControlStateNormal];
|
||||
_cameraBtn.titleLabel.font = btnFont;
|
||||
[_cameraBtn addTarget:self action:@selector(takePhotoWasPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_cameraBtn setTitleColor:[@"0b60fe" colorFromHex] forState:UIControlStateNormal];
|
||||
[_cameraBtn setTitleColor:[@"70b3fd" colorFromHex] forState:UIControlStateHighlighted];
|
||||
_cameraBtn.hidden = !_haveCamera;
|
||||
[_imagePickerView addSubview:_cameraBtn];
|
||||
|
||||
_separator1 = [UIView newAutoLayoutView];
|
||||
_separator1.backgroundColor = [@"cacaca" colorFromHex];
|
||||
[_imagePickerView addSubview:_separator1];
|
||||
}
|
||||
|
||||
UIView *separator1 = [[UIView alloc] initWithFrame:CGRectMake(0, 140, screenWidth, 1)];
|
||||
separator1.backgroundColor = [@"cacaca" colorFromHex];
|
||||
[self.imagePickerView addSubview:separator1];
|
||||
|
||||
UIView *separator2 = [[UIView alloc] initWithFrame:CGRectMake(25, 187, screenWidth-25, 1)];
|
||||
separator2.backgroundColor = [@"cacaca" colorFromHex];
|
||||
[self.imagePickerView addSubview:separator2];
|
||||
UIView *separator3 = [[UIView alloc] initWithFrame:CGRectMake(25, 234, screenWidth-25, 1)];
|
||||
separator3.backgroundColor = [@"cacaca" colorFromHex];
|
||||
[self.imagePickerView addSubview:separator3];
|
||||
[_imagePickerView addSubview:_collectionView];
|
||||
[_imagePickerView addSubview:_photoLibraryBtn];
|
||||
[_imagePickerView addSubview:_cancelBtn];
|
||||
|
||||
[self.imagePickerView addSubview:self.collectionView];
|
||||
[self.imagePickerView addSubview:self.photoLibraryBtn];
|
||||
[self.imagePickerView addSubview:self.cameraBtn];
|
||||
[self.imagePickerView addSubview:self.cancelBtn];
|
||||
[self.view addSubview:_imagePickerView];
|
||||
|
||||
[self.view setNeedsUpdateConstraints];
|
||||
[_imagePickerView setNeedsUpdateConstraints];
|
||||
[_collectionView setNeedsUpdateConstraints];
|
||||
[_backgroundView setNeedsUpdateConstraints];
|
||||
|
||||
}
|
||||
|
||||
- (void) updateViewConstraints {
|
||||
if (!_didUpdateConstraints) {
|
||||
_didUpdateConstraints = YES;
|
||||
|
||||
[_backgroundView autoPinEdgesToSuperviewEdges];
|
||||
|
||||
[_imagePickerView autoPinEdgeToSuperviewEdge:ALEdgeLeading];
|
||||
[_imagePickerView autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
|
||||
_hideConstraint = [_imagePickerView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:-imagePickerHeight];
|
||||
[_imagePickerView autoSetDimension:ALDimensionHeight toSize:100 relation:NSLayoutRelationGreaterThanOrEqual];
|
||||
|
||||
|
||||
[_cancelBtn autoPinEdgeToSuperviewEdge:ALEdgeLeading];
|
||||
[_cancelBtn autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
|
||||
[_cancelBtn autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_cancelBtn autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:15];
|
||||
[_cancelBtn autoSetDimension:ALDimensionHeight toSize:30];
|
||||
[_cancelBtn autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_cancelBtn autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
|
||||
[_separator3 autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_separator3 autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
[_separator3 autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_cancelBtn withOffset:-10];
|
||||
[_separator3 autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_separator3 autoSetDimension:ALDimensionHeight toSize:1];
|
||||
|
||||
[_photoLibraryBtn autoPinEdgeToSuperviewEdge:ALEdgeLeading];
|
||||
[_photoLibraryBtn autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
|
||||
[_photoLibraryBtn autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_photoLibraryBtn autoSetDimension:ALDimensionHeight toSize:30];
|
||||
[_photoLibraryBtn autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_separator3 withOffset:-10];
|
||||
[_photoLibraryBtn autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_photoLibraryBtn autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
|
||||
[_separator2 autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_separator2 autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
[_separator2 autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_photoLibraryBtn withOffset:-10];
|
||||
[_separator2 autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_separator2 autoSetDimension:ALDimensionHeight toSize:1];
|
||||
|
||||
if (_haveCamera) {
|
||||
[_cameraBtn autoPinEdgeToSuperviewEdge:ALEdgeLeading];
|
||||
[_cameraBtn autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
|
||||
[_cameraBtn autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_cameraBtn autoSetDimension:ALDimensionHeight toSize:30];
|
||||
[_cameraBtn autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_separator2 withOffset:-10];
|
||||
[_cameraBtn autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_cameraBtn autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
|
||||
[_separator1 autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:10];
|
||||
[_separator1 autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
||||
[_separator1 autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_cameraBtn withOffset:-10];
|
||||
[_separator1 autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_separator1 autoSetDimension:ALDimensionHeight toSize:1];
|
||||
}
|
||||
|
||||
[_collectionView autoPinEdgeToSuperviewEdge:ALEdgeLeading];
|
||||
[_collectionView autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
|
||||
[_collectionView autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
||||
[_collectionView autoSetDimension:ALDimensionHeight toSize:122];
|
||||
if (_haveCamera) {
|
||||
[_collectionView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_separator1 withOffset:-15];
|
||||
}
|
||||
else {
|
||||
[_collectionView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:_separator2 withOffset:-15];
|
||||
}
|
||||
|
||||
[_collectionView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:10];
|
||||
|
||||
}
|
||||
[super updateViewConstraints];
|
||||
}
|
||||
|
||||
- (void) viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
[self getCameraRollImages];
|
||||
}
|
||||
|
||||
#pragma mark - Collection view
|
||||
@ -160,13 +233,13 @@
|
||||
}
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return MIN(20, self.assets.count);
|
||||
return MIN(20, _assets.count);
|
||||
}
|
||||
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
PNCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[PNCollectionViewCell cellIdentifier] forIndexPath:indexPath];
|
||||
|
||||
PHAsset *asset = self.assets[self.assets.count-1 - indexPath.row];
|
||||
PHAsset *asset = _assets[_assets.count-1 - indexPath.row];
|
||||
|
||||
PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
|
||||
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
|
||||
@ -201,7 +274,7 @@
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
|
||||
PHAsset *asset = self.assets[self.assets.count-1 - indexPath.row];
|
||||
PHAsset *asset = _assets[_assets.count-1 - indexPath.row];
|
||||
PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
|
||||
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
|
||||
options.networkAccessAllowed = YES;
|
||||
@ -237,32 +310,31 @@
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return CGSizeMake(170, 114);
|
||||
return CGSizeMake(180, 120);
|
||||
}
|
||||
|
||||
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
|
||||
return 10.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#pragma mark - Image library
|
||||
|
||||
|
||||
- (void)getCameraRollImages {
|
||||
_assets = [@[] mutableCopy];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
PHFetchOptions *allPhotosOptions = [PHFetchOptions new];
|
||||
allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]];
|
||||
//[allPhotosOptions setFetchLimit:20];
|
||||
|
||||
PHFetchResult *allPhotosResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:allPhotosOptions];
|
||||
[allPhotosResult enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop) {
|
||||
NSLog(@"asset %@", asset);
|
||||
if(asset) {
|
||||
[self.assets addObject:asset];
|
||||
[_assets addObject:asset];
|
||||
}
|
||||
}];
|
||||
|
||||
[self.collectionView reloadData];
|
||||
[_collectionView reloadData];
|
||||
});
|
||||
}
|
||||
|
||||
@ -320,34 +392,49 @@
|
||||
}
|
||||
|
||||
- (void)showImagePickerInController:(UIViewController *)controller animated:(BOOL)animated {
|
||||
if (self.isVisible != YES) {
|
||||
if (_isVisible != YES) {
|
||||
if ([delegate respondsToSelector:@selector(imagePickerWillOpen)]) {
|
||||
[delegate imagePickerWillOpen];
|
||||
}
|
||||
self.isVisible = YES;
|
||||
_isVisible = YES;
|
||||
|
||||
[self setTransitioningDelegate:transitionController];
|
||||
self.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
||||
|
||||
[controller presentViewController:self animated:NO completion:nil];
|
||||
[controller presentViewController:self animated:NO completion:^{
|
||||
|
||||
if (animated) {
|
||||
[UIView animateWithDuration:self.animationTime
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveLinear
|
||||
animations:^{
|
||||
[self.imagePickerView setFrame:self.imagePickerFrame];
|
||||
[self.backgroundView setAlpha:1];
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
if ([delegate respondsToSelector:@selector(imagePickerDidOpen)]) {
|
||||
[delegate imagePickerDidOpen];
|
||||
[_imagePickerView setNeedsUpdateConstraints];
|
||||
[_imagePickerView updateConstraintsIfNeeded];
|
||||
|
||||
if (animated) {
|
||||
|
||||
[UIView animateWithDuration:_animationTime
|
||||
delay:0.0
|
||||
usingSpringWithDamping:1
|
||||
initialSpringVelocity:0
|
||||
options:0
|
||||
animations:^{
|
||||
|
||||
[_hideConstraint setConstant:0];
|
||||
|
||||
[_backgroundView setAlpha:1];
|
||||
|
||||
[_imagePickerView layoutIfNeeded];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
[self.imagePickerView setFrame:self.imagePickerFrame];
|
||||
[self.backgroundView setAlpha:0];
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
if ([delegate respondsToSelector:@selector(imagePickerDidOpen)]) {
|
||||
[delegate imagePickerDidOpen];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
|
||||
[_hideConstraint setConstant:0];
|
||||
|
||||
[_backgroundView setAlpha:1];
|
||||
|
||||
[_imagePickerView layoutIfNeeded];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,32 +445,49 @@
|
||||
}
|
||||
|
||||
- (void)dismissAnimated:(BOOL)animated {
|
||||
if (self.isVisible == YES) {
|
||||
if (_isVisible == YES) {
|
||||
if ([delegate respondsToSelector:@selector(imagePickerWillClose)]) {
|
||||
[delegate imagePickerWillClose];
|
||||
}
|
||||
[_imagePickerView setNeedsUpdateConstraints];
|
||||
[_imagePickerView updateConstraintsIfNeeded];
|
||||
|
||||
if (animated) {
|
||||
[UIView animateWithDuration:self.animationTime
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseIn
|
||||
|
||||
[UIView animateWithDuration:_animationTime
|
||||
delay:0.0
|
||||
usingSpringWithDamping:1
|
||||
initialSpringVelocity:0
|
||||
options:0
|
||||
animations:^{
|
||||
[self.imagePickerView setFrame:self.hiddenFrame];
|
||||
[self.backgroundView setAlpha:0];
|
||||
|
||||
[_hideConstraint setConstant:imagePickerHeight];
|
||||
|
||||
[_backgroundView setAlpha:0];
|
||||
|
||||
[_imagePickerView layoutIfNeeded];
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
[self.imagePickerView removeFromSuperview];
|
||||
[self.backgroundView removeFromSuperview];
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
if ([delegate respondsToSelector:@selector(imagePickerDidClose)]) {
|
||||
[delegate imagePickerDidClose];
|
||||
}
|
||||
[self dismissViewControllerAnimated:YES completion:^{
|
||||
if ([delegate respondsToSelector:@selector(imagePickerDidClose)]) {
|
||||
[delegate imagePickerDidClose];
|
||||
}
|
||||
}];
|
||||
}];
|
||||
} else {
|
||||
[self.imagePickerView setFrame:self.imagePickerFrame];
|
||||
[self.backgroundView setAlpha:0];
|
||||
}
|
||||
|
||||
// Set everything to nil
|
||||
[_hideConstraint setConstant:imagePickerHeight];
|
||||
|
||||
[_backgroundView setAlpha:0];
|
||||
|
||||
[_imagePickerView layoutIfNeeded];
|
||||
|
||||
[self dismissViewControllerAnimated:NO completion:^{
|
||||
if ([delegate respondsToSelector:@selector(imagePickerDidClose)]) {
|
||||
[delegate imagePickerDidClose];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,12 +520,12 @@
|
||||
UIView *inView = [transitionContext containerView];
|
||||
UIViewController *toVC = (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
|
||||
UIViewController *fromVC = (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
|
||||
|
||||
|
||||
[inView addSubview:toVC.view];
|
||||
|
||||
|
||||
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
||||
[toVC.view setFrame:CGRectMake(0, screenRect.size.height, fromVC.view.frame.size.width, fromVC.view.frame.size.height)];
|
||||
|
||||
|
||||
[UIView animateWithDuration:0.25f
|
||||
animations:^{
|
||||
[toVC.view setFrame:CGRectMake(0, 0, fromVC.view.frame.size.width, fromVC.view.frame.size.height)];
|
||||
|
||||
20
README.md
20
README.md
@ -18,6 +18,26 @@ it, simply add the following line to your Podfile:
|
||||
|
||||
```ruby
|
||||
pod "PNImagePickerViewController"
|
||||
```
|
||||
|
||||
|
||||
```ruby
|
||||
|
||||
#import <PNImagePickerViewController/PNImagePickerViewController.h>
|
||||
|
||||
PNImagePickerViewController *imagePicker = [[PNImagePickerViewController alloc] init];
|
||||
imagePicker.delegate = self;
|
||||
[imagePicker showImagePickerInController:self animated:YES];
|
||||
|
||||
|
||||
#pragma mark - PNImagePickerViewControllerDelegate
|
||||
|
||||
- (void)imagePicker:(PNImagePickerViewController *)imagePicker didSelectImage:(UIImage *)image {
|
||||
self.imageView.image = image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user