Skip to content

Commit 3b90734

Browse files
committed
Merge pull request IFTTT#1690 from ashavit/ScrollViewPageConstraintBug
ScrollViewPageConstraintAnimation - Consider initial constant too
2 parents 1d0f277 + f4ec352 commit 3b90734

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

JazzHands/IFTTTScrollViewPageConstraintAnimation.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ @interface IFTTTScrollViewPageConstraintAnimation ()
1212

1313
@property (nonatomic, strong) UIView *superview;
1414
@property (nonatomic, strong) NSLayoutConstraint *constraint;
15+
@property (nonatomic, assign) CGFloat initialConstraintConstant;
1516
@property (nonatomic, assign) IFTTTHorizontalPositionAttribute attribute;
1617

1718
@end
@@ -23,6 +24,7 @@ - (instancetype)initWithSuperview:(UIView *)superview constraint:(NSLayoutConstr
2324
if ((self = [super init])) {
2425
_superview = superview;
2526
_constraint = constraint;
27+
_initialConstraintConstant = constraint.constant;
2628
_pageWidth = pageWidth;
2729
_attribute = attribute;
2830
}
@@ -62,7 +64,7 @@ - (void)animate:(CGFloat)time
6264
break;
6365
}
6466

65-
self.constraint.constant = (offset + page) * self.pageWidth;
67+
self.constraint.constant = (offset + page) * self.pageWidth + self.initialConstraintConstant;
6668
[self.superview layoutIfNeeded];
6769
}
6870

0 commit comments

Comments
 (0)