I am having a very difficult time understanding this. I have a UITableView which frameHeight is set at 200. Although I’ve set numberOfRows to 0, this UITableView still scrolls, any idea why? My understanding is that it will only scroll if the contentView height is bigger than the frameHeight right? But in the case of the numberOfRows of 0, the contentView should be 0?
Share
First Solution use UITableViewStyleGrouped style
Because by default it is set to UITableViewStylePlain which shows empty cells too after displaying filled cells.
Second Indirect Way
You can run this code after calling reloadData on the table, and it calculates the right sizes and appears to work.
Edit 1
Another way is to disable Bounce -> Bounces/ Bounce Vertically
Hope this will solve your problem