Skip to content

Commit 36e67a0

Browse files
committed
Cleaned up current page calculation and bumped version to 2.0.1
1 parent 66fdd58 commit 36e67a0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

SCPageViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SCPageViewController'
3-
s.version = '2.0.0'
3+
s.version = '2.0.1'
44
s.platform = :ios
55
s.ios.deployment_target = '5.0'
66

SCPageViewController/SCPageViewController.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,7 @@ - (NSUInteger)_calculateCurrentPage
761761
SCPageViewControllerPageDetails *newDetails = [[SCPageViewControllerPageDetails alloc] init];
762762
NSUInteger zPosition = pages.count - i - 1;
763763
if([self.layouter respondsToSelector:@selector(zPositionForPageAtIndex:pageViewController:)]) {
764-
zPosition = [self.layouter zPositionForPageAtIndex:i
765-
pageViewController:self];
764+
zPosition = [self.layouter zPositionForPageAtIndex:i pageViewController:self];
766765
}
767766

768767
[newDetails setZPosition:zPosition];
@@ -778,7 +777,7 @@ - (NSUInteger)_calculateCurrentPage
778777
NSUInteger pageIndex = [pages indexOfObject:sortedPages[i]];
779778

780779
CGRect frame = [self.layouter finalFrameForPageAtIndex:pageIndex pageViewController:self];
781-
CGPoint centerOffset = [self.view convertPoint:CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds)) toView:self.scrollView];
780+
CGPoint centerOffset = [self.view convertPoint:self.scrollView.center toView:self.scrollView];
782781

783782
if(CGRectContainsPoint(frame, centerOffset)) {
784783
return pageIndex;

0 commit comments

Comments
 (0)