Skip to content

Instantly share code, notes, and snippets.

@leafduo
Created October 3, 2012 12:23
Show Gist options
  • Select an option

  • Save leafduo/3826662 to your computer and use it in GitHub Desktop.

Select an option

Save leafduo/3826662 to your computer and use it in GitHub Desktop.
UIImage* resizableImageWithCapInsets(id self, SEL _cmd, UIEdgeInsets capInsets) {
return [self stretchableImageWithLeftCapWidth:capInsets.left topCapHeight:capInsets.top];
}
- (void)addMissingMethod {
if (![UIImage instancesRespondToSelector:@selector(resizableImageWithCapInsets:)]) {
class_addMethod([UIImage class], @selector(resizableImageWithCapInsets:), (IMP) resizableImageWithCapInsets, "@@:{top=CGFloat, left=CGFloat, bottom=CGFloat, right=CGFloat");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment