Created
April 3, 2013 05:04
-
-
Save tediscript/5298571 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
| - (UIImage*) drawText:(NSString*)text inImage:(UIImage*)bgImage atPoint:(CGPoint)point withSize:(CGFloat)size withColor:(UIColor*) color { | |
| UIGraphicsBeginImageContextWithOptions(bgImage.size, FALSE, 0.0); | |
| [bgImage drawInRect:CGRectMake( 0, 0, bgImage.size.width, bgImage.size.height)]; | |
| UIFont *font = [UIFont boldSystemFontOfSize:size]; | |
| CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
| CGContextSetFillColorWithColor(ctx, color.CGColor); | |
| [text drawAtPoint:point withFont:font]; | |
| UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return newImage; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment