diff --git a/Demo/ObjCDemo/SCRootViewController.m b/Demo/ObjCDemo/SCRootViewController.m index 6c855f1..dea7a52 100644 --- a/Demo/ObjCDemo/SCRootViewController.m +++ b/Demo/ObjCDemo/SCRootViewController.m @@ -52,6 +52,8 @@ - (void)viewDidLoad [self.pageViewController.view setFrame:self.view.bounds]; [self.view addSubview:self.pageViewController.view]; [self.pageViewController didMoveToParentViewController:self]; + + [self _updateViewControllerDetails]; } #pragma mark - SCPageViewControllerDataSource @@ -77,6 +79,11 @@ - (UIViewController *)pageViewController:(SCPageViewController *)pageViewControl return viewController; } +- (NSUInteger)initialPageInPageViewController:(SCPageViewController *)pageViewController +{ + return 4; +} + #pragma mark - SCPageViewControllerDelegate - (void)pageViewController:(SCPageViewController *)pageViewController didNavigateToOffset:(CGPoint)offset diff --git a/README.md b/README.md index 9c86bf6..8d29a09 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,13 @@ SCPageViewController relies on page layouters to know where to place each of the [self.pageViewController setLayouter:[[SCPageLayouter alloc] init] animated:NO completion:nil]; ``` -- Implement the SCPageViewControllerDataSource which defines the total number of pages and the view controllers to be used for each of them. +- Implement the SCPageViewControllerDataSource to define the total number of pages, the view controllers to be used for each of them and which one show be displayed first. ```objc - (NSUInteger)numberOfPagesInPageViewController:(SCPageViewController *)pageViewController; - (UIViewController *)pageViewController:(SCPageViewController *)pageViewController viewControllerForPageAtIndex:(NSUInteger)pageIndex; + - (NSUInteger)initialPageInPageViewController:(SCPageViewController *)pageViewController; ``` diff --git a/SCPageViewController/SCPageViewController.h b/SCPageViewController/SCPageViewController.h index 1b86df5..5d4afe3 100644 --- a/SCPageViewController/SCPageViewController.h +++ b/SCPageViewController/SCPageViewController.h @@ -215,7 +215,7 @@ /** * @param pageViewController The calling PageViewController - * @return The initial page that should be load. Otherwise the first is chosen. + * @return The initial page that should be loaded, otherwise the first is chosen. */ @optional - (NSUInteger)initialPageInPageViewController:(SCPageViewController *)pageViewController; diff --git a/SCPageViewController/SCPageViewController.m b/SCPageViewController/SCPageViewController.m index 570b5df..517d935 100644 --- a/SCPageViewController/SCPageViewController.m +++ b/SCPageViewController/SCPageViewController.m @@ -42,9 +42,6 @@ @interface SCPageViewController ()