Created
October 30, 2013 16:51
-
-
Save psobko/7236055 to your computer and use it in GitHub Desktop.
Add a bottom border to a UIImage
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*)imageWithBorderFromImage:(UIImage*)source; | |
| { | |
| CGSize size = [source size]; | |
| UIGraphicsBeginImageContextWithOptions(CGSizeMake(size.width, size.height+20), NO, 0.0); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| [source drawInRect:CGRectMake(0, 20, size.width, 44)]; | |
| CGContextFillRect(context, CGRectMake(0, 0, size.width, 20)); | |
| UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return newImage; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment