Created
December 15, 2010 06:16
-
-
Save amudi/741690 to your computer and use it in GitHub Desktop.
[iOS] UILabel+Striketrough
This file contains 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 { | |
if (self.text && [self.text length] > 0) { | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
[self.textColor set]; | |
[self.text drawInRect:rect withFont:self.font]; | |
CGContextSetStrokeColorWithColor(context, self.textColor.CGColor); | |
CGContextSetLineWidth(context, 1.0f); | |
CGContextMoveToPoint(context, CGRectGetMinX(rect), CGRectGetMidY(rect)); | |
CGContextAddLineToPoint(context, CGRectGetMaxX(rect), CGRectGetMidY(rect)); | |
CGContextStrokePath(context); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment