Skip to content

Commit

Permalink
Update currentPageIndex setter
Browse files Browse the repository at this point in the history
  • Loading branch information
ealeksandrov committed Dec 6, 2015
1 parent 58bfaab commit a5ce2c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion EAIntroView/EAIntroView.m
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,13 @@ - (void)setCurrentPageIndex:(NSUInteger)currentPageIndex animated:(BOOL)animated
return;
}

_currentPageIndex = currentPageIndex;

CGFloat offset = currentPageIndex * self.scrollView.frame.size.width;
CGRect pageRect = { .origin.x = offset, .origin.y = 0.0, .size.width = self.scrollView.frame.size.width, .size.height = self.scrollView.frame.size.height };
[self.scrollView scrollRectToVisible:pageRect animated:animated];

if(!animated) {
_currentPageIndex = currentPageIndex;
[self scrollViewDidScroll:self.scrollView];
}
}
Expand Down

0 comments on commit a5ce2c3

Please sign in to comment.