Created
October 1, 2014 19:55
-
-
Save ro31337/fae2cc512a560bfa8e37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)drawRect:(CGRect)rect | |
| { | |
| [super drawRect:rect]; | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGRect rect = self.bounds; | |
| UIColor *separatorColor = [UIColor colorWithRed:208.0/255.0 green:208.0/255.0 blue:208.0/255.0 alpha:1.0]; | |
| for (int i = 0; i < [columns count]; i++) | |
| { | |
| CGFloat f = [((NSNumber*) [columns objectAtIndex:i]) floatValue]; | |
| drawLine(context, CGPointMake(f, 1), CGPointMake(f, rect.size.height), separatorColor.CGColor); | |
| } | |
| } | |
| void drawLine(CGContextRef context, CGPoint startPoint, CGPoint endPoint, | |
| CGColorRef color) | |
| { | |
| CGContextSaveGState(context); | |
| CGContextSetLineCap(context, kCGLineCapSquare); | |
| CGContextSetStrokeColorWithColor(context, color); | |
| CGContextSetLineWidth(context, 1.0); | |
| CGContextMoveToPoint(context, startPoint.x + 0.5, startPoint.y + 0.5); | |
| CGContextAddLineToPoint(context, endPoint.x + 0.5, endPoint.y + 0.5); | |
| CGContextStrokePath(context); | |
| CGContextRestoreGState(context); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment