Closed AlexIzh closed 8 years ago
animation
to differentiate scroll action between dragging and tap menuview. (for some reason i dont want it call menuView?.slideMenuAtProgress(rate)
in scrollViewDidScroll
when user tapped the item)selectedIndex
can meet your needs? For example, if you want show the second page, just set pageController.selectedIndex = 1
, hope that helps.Unfortunately, no. It will not help me. I need scroll contentView and myView together. So, I observe "contentOffset" of contentView and when it is changed, I change contentOffset of myView. But when myView contentOffset is changed, I need change contentOffset of contentView, and it works properly when animate property is true.
On 31 Mar 2016, at 18:21, Wang Ming notifications@github.com wrote:
I use animation to differentiate scroll action between dragging and tap menuview. (for some reason i dont want it call menuView?.slideMenuAtProgress(rate) in scrollViewDidScroll when user tapped the item) I don't konw whether the property selectedIndex can meet your needs? For example, if you want show the second page, just set pageController.selectedIndex = 1, hope that helps. — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/wangmchn/WMPageController-Swift/issues/6#issuecomment-203960404
Mmmm..if you dont want pageAnimation = true, just delete animation property, it's no use if pageAnimation = false.
Problem is that I use Pods, but animate property is private. I cannot remove it or set true value
Alex
31 марта 2016 г., в 19:42, Wang Ming notifications@github.com написал(а):
Mmmm..if you dont want pageAnimation = true, just delete animation property, it's no use if pageAnimation = false.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub
If I make animate property public, will it be fine for you to set true before programmatically dragging it?
I have made it public and changed the name from animate
to startDragging
. Tell me whether it works - -
Problem was not animate
property only. For solution this issue I implemented scroll view delegate methods for my scroll view and called these methods for pageController.
For example(I have iCarousel, but it will work with another scrollView):
func carouselWillBeginDragging(carousel: iCarousel) {
guard let page = self.pageMenuView?.pageController else { return }
guard let contentView = page.contentView else { return }
page.scrollViewWillBeginDragging(contentView)
}
func carouselDidEndDecelerating(carousel: iCarousel) {
guard let page = self.pageMenuView?.pageController else { return }
guard let contentView = page.contentView else { return }
page.scrollViewDidEndDecelerating(contentView)
}
func carouselDidEndScrollingAnimation(carousel: iCarousel) {
guard let page = self.pageMenuView?.pageController else { return }
guard let contentView = page.contentView else { return }
page.scrollViewDidEndScrollingAnimation(contentView)
}
func carouselDidEndDragging(carousel: iCarousel, willDecelerate decelerate: Bool) {
guard let page = self.pageMenuView?.pageController else { return }
guard let contentView = page.contentView else { return }
var point = calculateTargetContentOffsetFrom(carousel)
let p = withUnsafeMutablePointer(&point) { $0 }
page.scrollViewWillEndDragging(contentView, withVelocity: CGPointZero, targetContentOffset: p)
page.scrollViewDidEndDragging(contentView, willDecelerate: true)
}
Hey, @AlexIzh
Sorry for replying late.
I have made a demo, is that what you want? (scroll the top view and contentview scroll togather)
In your code, I dont understand what is pageMenuView
? And why it has a pageController.
Here is the Example:
Example.zip
1/ I don't understand why we need "animation" private property? It does not contain any information after user dragged manually content (this property is not resetted anywhere). 2/ How I can programmatically drag content? If I set contentOffset for contentView, then I see next: if user dragged content already, then it works, but if user did not drag yet, then it does not work. It happens because "animation" property is false