Answer the question
In order to leave comments, you need to log in
How to make two UIScrollView dependent on each other?
Good afternoon.
The crux of the problem is this, there are two separate UIScrollViews on the same ViewController.
How to connect them together so that when you move one second one moves identically?
Has anyone else experienced this
? Thank you in advance for your replies!
Answer the question
In order to leave comments, you need to log in
Try like this:
class MultiScrollViewController: UIViewController {
// ...
override func viewDidLoad() {
super.viewDidLoad()
firstView.delegate = self
secondView.delegate = self
}
// ...
}
extension MultiScrollViewController: UIScrollViewDelegate {
func scrollViewDidScroll(scrollView: UIScrollView) {
firstView.contentOffset = scrollView.contentOffset
secondView.contentOffset = scrollView.contentOffset
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question