Skip to content

Instantly share code, notes, and snippets.

@ethanbing
Created May 16, 2014 10:14
Show Gist options
  • Save ethanbing/158ea8d80144bdbeda67 to your computer and use it in GitHub Desktop.
Save ethanbing/158ea8d80144bdbeda67 to your computer and use it in GitHub Desktop.
绘制三角
//绘制三角
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextBeginPath(context);
CGContextMoveToPoint (context, CGRectGetMinX(rect), CGRectGetMaxY(rect));
CGContextAddLineToPoint(context, CGRectGetMidX(rect), CGRectGetMinY(rect));
CGContextAddLineToPoint(context, CGRectGetMaxX(rect), CGRectGetMaxY(rect));
CGContextClosePath(context);
CGContextSetFillColorWithColor(context, [[[self class] indicatorColor] CGColor]);
CGContextFillPath(context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment