-
Notifications
You must be signed in to change notification settings - Fork 291
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
How can I implement the page indicator from the IFTTT app? #35
Comments
There's no built-in page control, but you can trivially create one: let pageControl: UIPageControl = {
let control = UIPageControl()
control.translatesAutoresizingMaskIntoConstraints = false
control.currentPage = 0
control.pageIndicatorTintColor = UIColor.yellowColor()
control.currentPageIndicatorTintColor = UIColor.purpleColor()
return control
}() Configure it in pageControl.numberOfPages = 4 // make sure this is correct
view.addSubview(pageControl)
// constrain the page control's location
NSLayoutConstraint(item: pageControl, attribute: .Bottom, relatedBy: .Equal, toItem: contentView, attribute: .Bottom, multiplier: 1, constant: -20).active = true
NSLayoutConstraint(item: pageControl, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1, constant: 0).active = true Finally, in the scroll view delegate, update the current page: override func scrollViewDidScroll(scrollView: UIScrollView) {
animator.animate(scrollView.contentOffset.x)
// …
let currentPage = Int(scrollView.contentOffset.x / pageWidth)
pageControl.currentPage = currentPage
} |
This if fucking up the animations :) .. It shows the pagecontrol, but its not working properly |
@nharbo instead of complaining, you can look into the implementation and if you didn't do that, here is how you can fix it : Just call |
Is there an option to enable that page indicator at the bottom of the intro to IFTTT app?
The text was updated successfully, but these errors were encountered: