Reputation: 6614
I have a UITableView
that scrolls up too far, to the point where the list of items in the UITableView
scroll up and then a large amount of whitespace follows it.
How can I stop UITableView
from scrolling that extra space?
Hope I described it well enough.
Upvotes: 0
Views: 1024
Reputation: 9979
This will fix your problem
TableView.bounces=NO;
This will remove empty cells
TableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Upvotes: 1
Reputation: 27235
I think this may work for you. Run this code after calling reloadData
on the table :
if (table.contentSize.height < table.frame.size.height)
{
table.scrollEnabled = NO;
}
else
{
table.scrollEnabled = YES;
}
Here ,table.frame.size.height
is the actual size of the object (you can see this in Interface Builder) displayed on the screen, whereas table.contentSize.height
is the height of the header
, the footer
, and the height of every cell
added together.
I found it here : How to disable scrolling in UITableView table when the content fits on the screen
Hope you can get something from the answers given their also.
Upvotes: 2