Last active
August 29, 2015 13:56
-
-
Save amster/9204295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)goToPreviousPage:(id)sender { | |
int currentPage = [[self.pager.viewControllers objectAtIndex:0] idx]; | |
// Don't do anything if we're already at the first page | |
if (currentPage =< 0) { | |
return; | |
} | |
// Instead get the view controller of the previous page | |
SomePageViewController *newInitialViewController = (SomePageViewController *)[self viewControllerAtIndex:(currentPage - 1)]; | |
NSArray *initialViewControllers = [NSArray arrayWithObject:newInitialViewController]; | |
// Do the setViewControllers: again but this time use direction animation: | |
[self.pager setViewControllers:initialViewControllers direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment