Skip to content

Instantly share code, notes, and snippets.

@Amosel
Created October 9, 2011 11:07
Show Gist options
  • Save Amosel/1273555 to your computer and use it in GitHub Desktop.
Save Amosel/1273555 to your computer and use it in GitHub Desktop.
@implementation UIImage (AmosAddtions)
+(UIImage*) imageWithFirstRowOfImageNamed:(NSString*)imageName
{
UIImage* firstImage = [UIImage imageNamed:imageName];
UIImage* newImage = nil;
if (firstImage)
{
UIGraphicsBeginImageContext(CGSizeMake(1, firstImage.size.height));
[firstImage drawAtPoint:CGPointMake(0, 0)];
newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
return [newImage stretchableImageWithLeftCapWidth:0 topCapHeight:0];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment