Skip to content

Instantly share code, notes, and snippets.

@parrots
Created December 17, 2014 21:42
Show Gist options
  • Save parrots/2eec61206d87af8899ca to your computer and use it in GitHub Desktop.
Save parrots/2eec61206d87af8899ca to your computer and use it in GitHub Desktop.
Work around IB_Designable bug with template images and Interface Builder
@import UIKit;
IB_DESIGNABLE @interface CBCImageView : UIImageView
@end
@implementation CBCImageView
- (void)awakeFromNib
{
[super awakeFromNib];
[self cbc_fixTint];
}
#if TARGET_INTERFACE_BUILDER
- (void)layoutSubviews
{
[super layoutSubviews];
[self cbc_fixTint];
}
#endif
- (void)cbc_fixTint
{
UIImage *image = self.image;
self.image = nil;
self.image = image;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment