Bernd
Bernd

Reputation: 11493

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

Upvotes: 6

Views: 8281

Answers (1)

rob mayoff
rob mayoff

Reputation: 385580

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

Upvotes: 15

Related Questions