Created
June 25, 2014 04:59
-
-
Save n8gray/56383833d15764c9ac70 to your computer and use it in GitHub Desktop.
No Jerry, I'm not fucking with you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// At some point I thought this was very clever | |
// | |
// Six months later I was like, why the hell is the tag on this view 1008017??!?! | |
-(void)awakeFromNib | |
{ | |
[super awakeFromNib]; | |
int tag = [self tag]; | |
if (tag > 1000000) { | |
int residue = tag - (tag / 1000000) * 1000000; | |
int leftCap = residue / 1000; | |
int topCap = residue - 1000 * leftCap; | |
UIImage *img; | |
img = [self backgroundImageForState:UIControlStateNormal]; | |
if (img) { | |
img = [img stretchableImageWithLeftCapWidth:leftCap topCapHeight:topCap]; | |
[self setBackgroundImage:img forState:UIControlStateNormal]; | |
} | |
img = [self backgroundImageForState:UIControlStateHighlighted]; | |
if (img) { | |
img = [img stretchableImageWithLeftCapWidth:leftCap topCapHeight:topCap]; | |
[self setBackgroundImage:img forState:UIControlStateHighlighted]; | |
} | |
img = [self backgroundImageForState:UIControlStateSelected]; | |
if (img) { | |
img = [img stretchableImageWithLeftCapWidth:leftCap topCapHeight:topCap]; | |
[self setBackgroundImage:img forState:UIControlStateSelected]; | |
} | |
img = [self backgroundImageForState:UIControlStateDisabled]; | |
if (img) { | |
img = [img stretchableImageWithLeftCapWidth:leftCap topCapHeight:topCap]; | |
[self setBackgroundImage:img forState:UIControlStateDisabled]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment