Created
June 5, 2016 11:18
-
-
Save olxios/324aa9b88ed4435dcd4c1bdfa4aa337f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@implementation ViewController | |
#pragma mark View Lifecycle | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self createPageViewController]; | |
[self setupPageControl]; | |
} | |
- (void)createPageViewController | |
{ | |
_contentImages = @[@"nature_pic_1", | |
@"nature_pic_2", | |
@"nature_pic_3", | |
@"nature_pic_4"]; | |
UIPageViewController *pageController = [self.storyboard instantiateViewControllerWithIdentifier:@"PageController"]; | |
pageController.dataSource = self; | |
if([_contentImages count]) | |
{ | |
NSArray *startingViewControllers = @[[self itemControllerForIndex:0]]; | |
[pageController setViewControllers:startingViewControllers | |
direction:UIPageViewControllerNavigationDirectionForward | |
animated:NO | |
completion:nil]; | |
} | |
self.pageViewController = pageController; | |
[self addChildViewController:self.pageViewController]; | |
[self.view addSubview:self.pageViewController.view]; | |
[self.pageViewController didMoveToParentViewController:self]; | |
} | |
- (void)setupPageControl | |
{ | |
[[UIPageControl appearance] setPageIndicatorTintColor:[UIColor grayColor]]; | |
[[UIPageControl appearance] setCurrentPageIndicatorTintColor:[UIColor whiteColor]]; | |
[[UIPageControl appearance] setBackgroundColor:[UIColor darkGrayColor]]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment