Possible Duplicate:
Circle to Circle Segment Collision
I am the beginner with iOS development. Do you know how to draw a image like this http://www.hoodshomecenters.com/product_images/v/723/QuarterRound__65714_zoom.jpg with CoreGraphic?
Possible Duplicate:
Circle to Circle Segment Collision
I am the beginner with iOS development. Do you know how to draw a image like this http://www.hoodshomecenters.com/product_images/v/723/QuarterRound__65714_zoom.jpg with CoreGraphic?
This is the code for drawing the arc portion. Once it is drawn then you can draw lines within it.
#include <math.h>
CGFloat radius = 100;
CGFloat starttime = M_PI/6; //1 pm = 1/6 rad
CGFloat endtime = M_PI; //6 pm = 1 rad
//draw arc
CGPoint center = CGPointMake(radius,radius);
UIBezierPath *arc = [UIBezierPath bezierPath]; //empty path
[arc moveToPoint:center];
CGPoint next;
next.x = center.x + radius * cos(starttime);
next.y = center.y + radius * sin(starttime);
[arc addLineToPoint:next]; //go one end of arc
[arc addArcWithCenter:center radius:radius startAngle:starttime endAngle:endtime clockwise:YES]; //add the arc
[arc addLineToPoint:center]; //back to center
[[UIColor yellowColor] set];
[arc fill];
You need to overwrite the drawRect method of the view in which you will be used for showing this drawing.
You can draw an arc segment with the UIBezierPath
class using the method bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise
. Have a look here
You will also need to create a path for your lines using the combination of CGContextMoveToPoint/ CGContextAddLineToPoint
Last you stroke your lines by invoking the stroke
method on your path.
EDIT
To draw the inner lines you probably want to clip those: this is done with the CGContextClip
function