Skip to content

Instantly share code, notes, and snippets.

@slabko
Created January 23, 2015 12:32
Show Gist options
  • Save slabko/ff557137608b97ec0c24 to your computer and use it in GitHub Desktop.
Save slabko/ff557137608b97ec0c24 to your computer and use it in GitHub Desktop.
Apple Store's app Activity Indicator
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