baobao
3/17/2013 - 2:44 PM

CoreGraphicsのテストコード setNeedDisplayメソッドで表示される

CoreGraphicsのテストコード setNeedDisplayメソッドで表示される

- (void)drawRect:(CGRect)rect
{
    [super drawRect:rect];
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetRGBFillColor(context,
                             1.0, 0.5, 0.0, 1.0);
    CGContextSetRGBStrokeColor(context,
                               1.0, 0.0, 0.5, 1.0);
    CGContextSetLineWidth(context, 10.0);
    CGRect r1 = CGRectMake(50.0 , 50.0, 100.0, 100.0);
    CGContextAddRect(context,r1);
    CGContextFillPath(context);
    CGRect r2 = CGRectMake(100.0 , 100.0, 100.0, 100.0);
    CGContextAddRect(context,r2);
    CGContextStrokePath(context);
    
}