-1

I juste watch this effect :

alt text http://grab.by/5UBM

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 ;)

Pierre
  • 10,593
  • 5
  • 50
  • 80

1 Answers1

1

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.

tadejsv
  • 2,085
  • 1
  • 18
  • 20
  • Yeah I don't want a code just hint I wanna success by myself ;) so AddLineToArc ? But I don't know how to color a CGPath – Pierre Aug 15 '10 at 14:43
  • Sorry, I was away for a while. Yes, add arc method would do (just look in the documentation). You don't set a color to the particular path, youjust set the color. Here's an example [[UIColor redColor] set]. You can also choose to set only the fill color (setFill) or the stroke color (setStroke). – tadejsv Aug 18 '10 at 16:48
  • Yes ok but I have to implement some CGContext ? – Pierre Aug 20 '10 at 13:59
  • You have to make a CGPath and add the arc to it. Then add the path to CGContext, and draw the path with CGContext. – tadejsv Aug 21 '10 at 15:28
  • Ok! Thanks ! So I made that and it works (http://grab.by/61nH) : - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGMutablePathRef path = CGPathCreateMutable(); CGPathAddArc(path, NULL, 150, 200, 100, 270*(PI/180), 280*(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); } I added a timer and try something but doesn't work for increasing end angle – Pierre Aug 22 '10 at 14:01
  • You mean you can't increase the angle of the arc? Post your code, maybe I can help. – tadejsv Aug 22 '10 at 19:04
  • I posted my cade as a new answer – Pierre Aug 22 '10 at 19:54