Created
February 25, 2014 07:18
-
-
Save amster/9204301 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)goToFirstPage:(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 first page | |
SomePageViewController *newInitialViewController = (SomePageViewController *)[self viewControllerAtIndex:0]; | |
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