Created
September 5, 2012 04:16
-
-
Save Me1000/3630322 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
@implementation VerticalLayoutView : CPView | |
{ | |
double gapBetweenViews; | |
} | |
- (void)setGapBetweenViews:(double)aGap | |
{ | |
gapBetweenViews = aGap; | |
} | |
- (double)gapBetweenViews | |
{ | |
return gapBetweenViews; | |
} | |
- (void)layoutSubviews | |
{ | |
[super layoutSubviews]; | |
var subviews = [self subviews], | |
currentY = 0; | |
for (var i = 0, c = [subviews count]; i < c; i++) | |
{ | |
var subview = [subviews objectAtIndex:i]; | |
CGRect currentFrame = [subview frame]; | |
var viewHeight = CGRectGetHeight(currentFrame); | |
[subview setFrame:CGRectMake(0, currentY, CGRectGetWidth(currentFrame), viewHeight]; | |
currentY += viewHeight + [self gapBetweenViews]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment