Skip to content

Instantly share code, notes, and snippets.

@baobao
Created March 17, 2013 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/e77b6f36ed74c46c408b to your computer and use it in GitHub Desktop.
Save baobao/e77b6f36ed74c46c408b to your computer and use it in GitHub Desktop.
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment