Fixed all the major issues, moving to snap animation.
This commit is contained in:
parent
d80cedf59f
commit
543ff1f62f
|
|
@ -140,7 +140,10 @@ static const CGFloat contractionVelocity = 140.f;
|
|||
deltaY = MAX(0, deltaY - self.previousYOffset + end);
|
||||
}
|
||||
|
||||
self.isContracting = deltaY < 0;
|
||||
if (fabs(deltaY) > FLT_EPSILON)
|
||||
{
|
||||
self.isContracting = deltaY < 0;
|
||||
}
|
||||
|
||||
deltaY = [(self.isContracting ? self.extensionController : self.navBarController) updateYOffset:deltaY];
|
||||
[(self.isContracting ? self.navBarController : self.extensionController) updateYOffset:deltaY];
|
||||
|
|
@ -151,8 +154,11 @@ static const CGFloat contractionVelocity = 140.f;
|
|||
|
||||
- (void)_handleScrollingEnded
|
||||
{
|
||||
TLYShyViewController *first = (self.isContracting ? self.extensionController : self.navBarController);
|
||||
TLYShyViewController *second = (self.isContracting ? self.navBarController : self.extensionController);
|
||||
|
||||
CGFloat deltaY = 0.f;
|
||||
CGFloat deltaY = [first snap:self.isContracting];
|
||||
deltaY += [second snap:self.isContracting];
|
||||
|
||||
CGPoint newContentOffset = self.scrollView.contentOffset;
|
||||
newContentOffset.y -= deltaY;
|
||||
|
|
|
|||
|
|
@ -62,11 +62,14 @@
|
|||
|
||||
- (CGFloat)snap:(BOOL)contract
|
||||
{
|
||||
CGFloat deltaY = (contract
|
||||
? self.expandedCenterValue.y - self.view.center.y
|
||||
: self.expandedCenterValue.y - self.contractionAmountValue);
|
||||
CGFloat newYCenter = (contract
|
||||
? self.expandedCenterValue.y - self.contractionAmountValue
|
||||
: self.expandedCenterValue.y);
|
||||
|
||||
return [self updateYOffset:deltaY];
|
||||
CGFloat deltaY = newYCenter - self.view.center.y;
|
||||
[self updateYOffset:deltaY];
|
||||
|
||||
return deltaY;
|
||||
}
|
||||
|
||||
- (void)expand
|
||||
|
|
|
|||
Loading…
Reference in New Issue