Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adamjernst
Last active March 26, 2016 06:42
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save adamjernst/2d52beb72506863f0ac5 to your computer and use it in GitHub Desktop.
Save adamjernst/2d52beb72506863f0ac5 to your computer and use it in GitHub Desktop.
@implementation FBStoryView
{
FBHeaderView *_headerView;
FBMessageView *_messageView;
FBAttachmentView *_attachmentView;
FBLikeBarView *_likeBarView;
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
_headerView = [[FBHeaderView alloc] init];
_messageView = [[FBMessageView alloc] init];
_attachmentView = [[FBAttachmentView alloc] init];
_likeBarView = [[FBLikeBarView alloc] init];
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_headerView][_messageView][_attachmentView][_likeBarView]|"
options:NSLayoutFormatAlignAllLeft
metrics:@{}
views:NSDictionaryOfVariableBindings(_headerView, _messageView, _attachmentView, _likeBarView)]];
for (UIView *view in @[_headerView, _messageView, _attachmentView, _likeBarView]) {
[self addSubview:view];
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[view]|"
options:NSLayoutFormatAlignAllTop
metrics:@{}
views:@{@"view": view}]];
}
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment