Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method to allows moving to previous page. #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Source/OnboardingViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,9 @@
*/
- (void)moveNextPage;

/**
* @brief Method to tell the onboarding view controller to automatically move to the previous page.
*/
- (void)movePreviousPage;

@end
8 changes: 8 additions & 0 deletions Source/OnboardingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ - (void)moveNextPage {
}
}

- (void)movePreviousPage {
NSInteger indexOfNextPage = [self.viewControllers indexOfObject:_currentPage] - 1;

if (indexOfNextPage >= 0) {
[self.pageVC setViewControllers:@[self.viewControllers[indexOfNextPage]] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:nil];
[self.pageControl setCurrentPage:indexOfNextPage];
}
}

#pragma mark - Onboarding content view controller delegate

Expand Down