From da392fe9dbf4fea8c1c06080774a21fa2a696ef3 Mon Sep 17 00:00:00 2001 From: mikeEllis Date: Fri, 14 Aug 2015 18:29:40 -0300 Subject: [PATCH] fix #54 --- .../XLTwitterPagerTabStripViewController.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m b/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m index b9aa27f..462747c 100644 --- a/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m +++ b/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m @@ -145,7 +145,16 @@ indexWasChanged:(BOOL)indexWasChanged { CGFloat distance = [self getDistanceValue]; - UIAccelerationValue xOffset = fromIndex < toIndex ? distance * fromIndex + distance * progressPercentage : distance * fromIndex - distance * progressPercentage; + UIAccelerationValue xOffset = 0; + if (fromIndex < toIndex ){ + xOffset = distance * fromIndex + distance * progressPercentage; + } + else if (fromIndex > toIndex){ + xOffset = distance * fromIndex - distance * progressPercentage; + } + else{ + xOffset = distance * fromIndex; + } [self.navigationScrollView setContentOffset:CGPointMake(xOffset, 0)]; [self setAlphaWithOffset:xOffset]; [_navigationPageControl setCurrentPage:self.currentIndex];