Skip to content

Instantly share code, notes, and snippets.

@k06a
Forked from arbales/UIImage_ResizableFallback.m
Last active December 13, 2015 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save k06a/4976028 to your computer and use it in GitHub Desktop.
Save k06a/4976028 to your computer and use it in GitHub Desktop.
Portable version of resizable UIImage constructor
@interface UIImage (ResizeableFallback)
- (UIImage *)resizableImageWithInsets:(UIEdgeInsets *)insets;
@end
@implementation
- (UIImage *)resizableImageWithInsets:(UIEdgeInsets *)insets
{
if ([UIImage respondsToSelector:@selector(resizableImageWithCapInsets:)])
return [self resizableImageWithCapInsets: insets];
return [self stretchableImageWithLeftCapWidth:insets.left topCapWidth:insets.top];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment