Created
December 30, 2009 22:59
-
-
Save sbrocket/266483 to your computer and use it in GitHub Desktop.
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
| - (void)loadNibAndInitializeWithFrame:(CGRect)finalFrame { | |
| NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"AppDisplayView" owner:self options:nil]; | |
| UIView *containerView = [nibObjects lastObject]; | |
| NSArray *subviewsToAdd = [containerView subviews]; | |
| self.frame = containerView.frame; | |
| for (UIView *view in subviewsToAdd) { | |
| [self addSubview:view]; | |
| } | |
| self.tag = containerView.tag; | |
| self.alpha = containerView.alpha; | |
| self.opaque = containerView.opaque; | |
| self.hidden = containerView.hidden; | |
| self.contentMode = containerView.contentMode; | |
| self.clipsToBounds = containerView.clipsToBounds; | |
| self.contentStretch = containerView.contentStretch; | |
| self.backgroundColor = containerView.backgroundColor; | |
| self.userInteractionEnabled = containerView.userInteractionEnabled; | |
| self.clearsContextBeforeDrawing = containerView.clearsContextBeforeDrawing; | |
| self.autoresizesSubviews = containerView.autoresizesSubviews; | |
| self.autoresizingMask = containerView.autoresizingMask; | |
| if (!CGRectEqualToRect(finalFrame, CGRectZero)) { | |
| self.frame = finalFrame; | |
| } | |
| } | |
| - (id)initWithFrame:(CGRect)frame { | |
| if ((self = [super initWithFrame:frame])) { | |
| [self loadNibAndInitializeWithFrame:frame]; | |
| } | |
| return self; | |
| } | |
| - (id)initWithCoder:(NSCoder*)aDecoder { | |
| if ((self = [super initWithCoder:aDecoder])) { | |
| [self loadNibAndInitializeWithFrame:self.frame]; | |
| } | |
| return self; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment