Open tundsdev opened 8 years ago
This is a great idea! We'd welcome a pull request for it, but not something we're planning to work on soon.
+1
+1
+1
You can add a UIPageControl manually and wire it up manually like so:
class PagedViewController: AnimatedPagingScrollViewController {
// Set this up using your preferred method, make sure it's on all pages
private let pageControl: UIPageControl
override func scrollViewDidScroll(scrollView: UIScrollView) {
super.scrollViewDidScroll(scrollView)
pageControl.currentPage = Int(pageOffset + 0.5)
}
}
I add 0.5 to the offset so that the page control changes right in between pages.
Edit: Added super.scrollViewDidScroll(scrollView)
so that we don't take away whatever RazzleDazzle does on scroll. :)
as @andreyrd showed it is actually super easy to add a UIPageControl. I did so myself (just never managed to post it here). Therefor my suggestion is to not add a build in UIPageControl
, but (since it's common) to provide a tutorial how to add a fully customizable UIPageControl
yourself. I guess a wiki page would be the best place to put it. I'll be happy to share my implementation if a tutorial / how to is the way to move with this issue.
Adding override func scrollViewDidScroll(scrollView: UIScrollView) { }
ruins the animations.. At least it does for me.. So any other suggestions? :)
Here what I did previously, hope that would help,
@IBOutlet weak var introPageControl: UIPageControl!
// Page Change Listener
internal override func scrollViewDidScroll(_ scrollView: UIScrollView) {
super.scrollViewDidScroll(scrollView)
let screenSize: CGRect = UIScreen.main.bounds
if scrollView.contentOffset.x.truncatingRemainder(dividingBy: screenSize.width) == 0 {
let index = scrollView.contentOffset.x / screenSize.width
// Set the new page index to the page control
introPageControl.currentPage = Int(index)
}
}
Hi i was wondering if you've developed pagination within the framework so that there's circles at the bottom of the screen to show the user the current view which they are on? Like the image attached.