In my app, I have two tableViews side by side. When the user scrolls on, I would like the second one to scroll at the same time, so it looks almost like one table with two d
UITableView is a subclass of UIScrollView. Swift solution:
extension yourViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let otherScrollView = (scrollView == tableViewLeft) ? tableViewRight : tableViewLeft
otherScrollView?.setContentOffset(scrollView.contentOffset, animated: false)
}
}
And stop the bounce of both the tables
tableViewLeft.bounces = false
tableViewRight.bounces = false
If you want to make vertical scroll Indicators go, write the below code
tableViewLeft.showsVerticalScrollIndicator = false
tableViewRight.showsVerticalScrollIndicator = false