Skip to content

Instantly share code, notes, and snippets.

@psobko
Created October 30, 2013 16:51
Show Gist options
  • Select an option

  • Save psobko/7236055 to your computer and use it in GitHub Desktop.

Select an option

Save psobko/7236055 to your computer and use it in GitHub Desktop.
Add a bottom border to a UIImage
- (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