Hi every one !
I juste watch this effect :
I would like to reproduce it. Is it simply a CGPath animation? Have you got some indications so implement this beautiful loader view ? Thanks for your tips ;)
Hi every one !
I juste watch this effect :
I would like to reproduce it. Is it simply a CGPath animation? Have you got some indications so implement this beautiful loader view ? Thanks for your tips ;)
It's not that hard actually.
I don't have time to write the code (although it would be relativly easy), but I'll give you a hint: use a timer and arc.
I tried this :
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.backgroundColor = [UIColor blackColor];
context = UIGraphicsGetCurrentContext();
second = 0;
}
return self;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(increase) userInfo:nil repeats:NO];
}
-(void)increase
{
second ++;
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddArc(path, NULL, 150, 200, 100, 270*(PI/180), second*(PI/180), false);
CGContextSetRGBStrokeColor(context, 1, 0, 0, 1);
CGContextSetLineWidth(context, 20);
CGContextSetShadowWithColor(context, CGSizeMake(0, 0), 30, [UIColor redColor].CGColor);
CGContextAddPath(context, path);
CGContextStrokePath(context);
[self setNeedsDisplay];
}
But I lost the draw and nothing is happening.