Created
September 28, 2012 10:22
-
-
Save matthewryan/3799030 to your computer and use it in GitHub Desktop.
Simple stroked label by overriding drawInRect:
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)drawTextInRect:(CGRect)rect { | |
CGContextRef c = UIGraphicsGetCurrentContext(); | |
CGContextSetLineWidth(c, self.shadowOffset.height); | |
CGContextSetLineJoin(c, kCGLineJoinRound); | |
CGContextSetTextDrawingMode(c, kCGTextStroke); | |
[self.shadowColor set]; | |
[self.text drawInRect:rect withFont:self.font lineBreakMode:self.lineBreakMode alignment:self.textAlignment]; | |
CGContextSetTextDrawingMode(c, kCGTextFill); | |
[self.textColor set]; | |
[self.text drawInRect:rect withFont:self.font lineBreakMode:self.lineBreakMode alignment:self.textAlignment]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment