Created
January 23, 2015 12:32
-
-
Save slabko/ff557137608b97ec0c24 to your computer and use it in GitHub Desktop.
Apple Store's app Activity Indicator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(20, 20) | |
radius:10 | |
startAngle:-2 endAngle:3 | |
clockwise:YES]; | |
CAShapeLayer *layer = [[CAShapeLayer alloc] init]; | |
layer.frame = CGRectMake(0, 0, 40, 40); | |
layer.strokeColor = [UIColor grayColor].CGColor; | |
layer.fillColor = nil; | |
layer.lineWidth = 1; | |
layer.path = path.CGPath; | |
[view.layer addSublayer:layer]; | |
CABasicAnimation *animation = [[CABasicAnimation alloc] init]; | |
animation.keyPath = @"transform.rotation"; | |
animation.duration = 1; | |
animation.toValue = @M_PI; | |
animation.additive = YES; | |
animation.cumulative = YES; | |
animation.repeatCount = HUGE_VALF; | |
[layer addAnimation:animation forKey:@"rotatation"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment