Skip to content

Instantly share code, notes, and snippets.

@ltebean
Created March 10, 2016 09:20
Show Gist options
  • Save ltebean/60cba7f13108620309a2 to your computer and use it in GitHub Desktop.
Save ltebean/60cba7f13108620309a2 to your computer and use it in GitHub Desktop.
Xib based view
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self load];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
[self load];
}
return self;
}
- (void)load
{
self.backgroundColor = [UIColor clearColor];
UIView *view = [[[NSBundle bundleForClass:[self class]] loadNibNamed:@"CommentView" owner:self options:nil] lastObject];
view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
view.frame = self.bounds;
[self addSubview: view];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment