Last active
March 26, 2016 06:42
-
-
Save adamjernst/2d52beb72506863f0ac5 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
@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