Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VGParallaxHeader/UIScrollView+VGParallaxHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef NS_ENUM(NSInteger, VGParallaxHeaderMode) {
VGParallaxHeaderModeFill,
VGParallaxHeaderModeTop,
VGParallaxHeaderModeTopFill,
VGParallaxHeaderModeBottomFill,
};

typedef NS_ENUM(NSInteger, VGParallaxHeaderStickyViewPosition) {
Expand Down
27 changes: 27 additions & 0 deletions VGParallaxHeader/UIScrollView+VGParallaxHeader.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ - (void)setupContentViewMode
case VGParallaxHeaderModeTopFill:
[self addContentViewModeTopFillConstraints];
break;
case VGParallaxHeaderModeBottomFill:
[self addContentViewModeBottomFillConstraints];
break;
case VGParallaxHeaderModeCenter:
default:
[self addContentViewModeCenterConstraints];
Expand Down Expand Up @@ -364,6 +367,30 @@ - (void)addContentViewModeTopFillConstraints
self.insetAwareSizeConstraint.priority = UILayoutPriorityDefaultHigh;
}


- (void)addContentViewModeBottomFillConstraints
{
[self.contentView autoPinEdgeToSuperviewEdge:ALEdgeLeft
withInset:0];
[self.contentView autoPinEdgeToSuperviewEdge:ALEdgeRight
withInset:0];

NSArray *array = [self.contentView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsMake(self.originalTopInset, 0, 0, 0)
excludingEdge:ALEdgeTop];
self.insetAwarePositionConstraint = [array firstObject];

NSLayoutConstraint *constraint = [self.contentView autoSetDimension:ALDimensionHeight
toSize:self.originalHeight
relation:NSLayoutRelationGreaterThanOrEqual];
constraint.priority = UILayoutPriorityRequired;

self.insetAwareSizeConstraint = [self.contentView autoMatchDimension:ALDimensionHeight
toDimension:ALDimensionHeight
ofView:self.containerView
withOffset:-self.originalTopInset];
self.insetAwareSizeConstraint.priority = UILayoutPriorityDefaultHigh;
}

- (void)addContentViewModeCenterConstraints
{
[self.contentView autoPinEdgeToSuperviewEdge:ALEdgeLeft
Expand Down