I have a ViewController which has 1000 of height and I put a few outlets to test the scrolling feature. The thing what I am trying to do is when you step into the tableView, scroll until the bottom of the tableView list and then keep scrolling to the bottom. In my code, it goes up but I can't get away from the tableView.
My storyboad with outlets:
Here is my code:
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let yOffset = scrollView.contentOffset.y
let svHeight = scrollView.bounds.height
let screenHeight = CGFloat(1000)
if scrollView == self.scrollView {
if yOffset >= svHeight - screenHeight {
scrollView.isScrollEnabled = false
myTV.isScrollEnabled = true
}
}
if scrollView == self.myTV {
if yOffset <= 0 {
self.scrollView.isScrollEnabled = true
self.myTV.isScrollEnabled = false
}
}
}
Solution:
I found the solution in under some question and worked for my problem. Resizing the tableView for the content worked well for me.
You can find the solution here.