Closed johncodeos closed 6 years ago
Thanks for the question, @JEKos. The auto scroll uses scrollToPage
method, which in tern uses setContentOffset(offset, animated:)
of the UIScrollView. In theory, if one shifts the content by the same amount on both scroll views they should both finish animation at the same time. However you are reporting that this is not the case, which is puzzling. Has anyone reported this issue on stackoverflow?
I tested outside the func scrollViewDidScroll(_ scrollView: UIScrollView)
,on viewDidLoad with a delay and it's working correctly. Probably it's scrollViewDidScroll
causing the problem because it prints
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
instead of
0
1
2
3
Sorry I did not get it:
func scrollViewDidScroll(_ scrollView: UIScrollView)
called multiple times when the bottom slideshow start to autoscroll, this thing causes problem to the top slideshow and makes to scroll slower the the default scroll.
It's kinda the same problem with that
I solved it! Thank you for the help! Here is the solution:
var correctpageindex = 0
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let currentpageindex = self.SlideshowBrands.auk.currentPageIndex!
if (correctpageindex != currentpageindex){
self.slideshowTop.auk.scrollToPage(atIndex: SlideshowBottom.auk.currentPageIndex!, animated: true)
correctpageindex = currentpageindex
}
}
I'm glad you found a solution. Happy New Year! :)
Hi, is there any setting for the speed of scroll? I want to use 2 Auk slideshow in one view, one at the top of the screen and the other one at the bottom, when the slideshow at the bottom changes with AutoScroll I want to change at the same position the slideshow at the top. I have already done that but using:
slideshowTop.auk.scrollToPage(atIndex: SlideshowBottom.auk.currentPageIndex!, animated: true)
, animation it's slower than the regular scrollview speed bottom slideshow uses.