Last active
August 29, 2015 14:11
-
-
Save gabriel/682c23a4b7210c1fc06b to your computer and use it in GitHub Desktop.
This file contains 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
// MyView.m | |
#import "MyView.h" | |
@interface MyView () | |
@property UIImageView *imageView; | |
@property DynamicHeightSubview *dynamicHeightSubview; | |
@end | |
@implementation MyView | |
- (void)sharedInit { | |
self.layout = [YOLayout layoutWithView:self]; | |
_imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MyImage.png"]]; | |
_dynamicHeightSubview = [[DynamicHeightSubview alloc] init]; | |
} | |
- (CGSize)layout:(id<YOLayout>)layout size:(CGSize)size { | |
CGFloat x = 10; | |
CGFloat y = 10; | |
x += [layout setOrigin:CGPointMake(x, y) view:_imageView].size.width + 10; | |
y += [layout setFrame:CGRectMake(x, y, size.width - x - 10, 0) sizeThatFits:YES].size.height; | |
return CGSizeMake(size.width, y); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment