Created
June 5, 2016 11:19
-
-
Save olxios/0ebbf8d79c88ca811cfb6e671dd2363b 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
// MARK: - View Lifecycle | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
createPageViewController() | |
setupPageControl() | |
} | |
private func createPageViewController() { | |
let pageController = self.storyboard!.instantiateViewControllerWithIdentifier("PageController") as! UIPageViewController | |
pageController.dataSource = self | |
if contentImages.count > 0 { | |
let firstController = getItemController(0)! | |
let startingViewControllers = [firstController] | |
pageController.setViewControllers(startingViewControllers, direction: UIPageViewControllerNavigationDirection.Forward, animated: false, completion: nil) | |
} | |
pageViewController = pageController | |
addChildViewController(pageViewController!) | |
self.view.addSubview(pageViewController!.view) | |
pageViewController!.didMoveToParentViewController(self) | |
} | |
private func setupPageControl() { | |
let appearance = UIPageControl.appearance() | |
appearance.pageIndicatorTintColor = UIColor.grayColor() | |
appearance.currentPageIndicatorTintColor = UIColor.whiteColor() | |
appearance.backgroundColor = UIColor.darkGrayColor() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment