Created
April 19, 2017 16:37
-
-
Save samwarnick/4cd98e13bd182de3361508e7146bc315 to your computer and use it in GitHub Desktop.
A few lines of code that are necessary to show the page indicator dots
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
/* | |
These functions are neccessary for the page indicator dots to show up. | |
They are optional functions of UIPageViewControllerDataSource, so they do not come up as overrides. | |
*/ | |
func presentationCount(for pageViewController: UIPageViewController) -> Int { | |
return orderedViewControllers.count | |
} | |
func presentationIndex(for pageViewController: UIPageViewController) -> Int { | |
return 0 | |
} | |
// In viewDidLoad, this will let you style the dots a bit | |
let pageControlAppearance = UIPageControl.appearance(whenContainedInInstancesOf: [PageViewController.self]) | |
pageControlAppearance.currentPageIndicatorTintColor = UIColor.stnRichElectricBlue | |
pageControlAppearance.pageIndicatorTintColor = UIColor.stnColumbiaBlue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment