在 iPhone 应用里画扇形的代码

转自:http://www.cocoachina.com/cms/plus/view.php?aid=2318

- (void)drawRect:(CGRect)rect 

{

    // Drawing code

    CGContextRef context =UIGraphicsGetCurrentContext();

    CGFloat rgba[] = {1.0,0.0,0.0,1.0};

    CGContextSetFillColor(context, rgba);

    CGContextMoveToPoint(context, 150.0, 200.0);

    CGContextAddArc(context, 150.0, 200.0, 100.0, 10.0, 200.0, 1);

    CGContextClosePath(context);

    CGContextDrawPath(context, kCGPathFillStroke);

}

你可能感兴趣的:(iPhone)