When scroll the tableview table section header should not scroll from his place only table cells should scrollable.
I selected UITableView style plain and disabled Bounce on scroll. But, Still it is little bit scrolling with table view cells when scrolling.
2
Answers
As per understanding, i think you can use a UITableView with a plain style and set the table view’s sectionHeaderTopPadding property to 0. Additionally, you can disable the bounce effect to prevent any unintentional scrolling of the section header. Here’s how you can do it:
By setting tableView.bounces to false, you prevent the table view from bouncing and thus prevent any scroll of the section header. Setting tableView.sectionHeaderTopPadding to 0 ensures that the section header remains fixed at the top without any additional padding.
This should result in a table view where only the table cells scroll while the section header remains fixed in place. Please note that the sectionHeaderTopPadding property is available starting from iOS 15, so make sure your deployment target includes this iOS version or use it accordingly if you are targeting older versions.
Use a
UICollectionView
with aUICollectionViewFlowLayout
, and the sectionHeadersPinToVisibleBounds property will do the trick