Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw a filled semi circle

What's the best method to draw a filled (!) semi circle in a UIView? I played around with the CGContextAddArc function but it does not seem to provide the filling. Here's what I like to draw - two filled semi circles.

enter image description here

like image 873
Bernd Avatar asked Mar 30 '12 21:03

Bernd


1 Answers

CGContextBeginPath(gc);
CGContextAddArc(gc, 100, 100, 50, -M_PI_2, M_PI_2, 1);
CGContextClosePath(gc); // could be omitted
CGContextSetFillColorWithColor(gc, [UIColor cyanColor].CGColor);
CGContextFillPath(gc);
like image 152
rob mayoff Avatar answered Sep 29 '22 12:09

rob mayoff