UITableView extra space at the bottom

My table has extra space below, as you see in the picture:

All rows in the View table have a fixed height of 71pt.

enter image description here

+12
ios uitableview storyboard
source share
8 answers

OK I understood.

"Customize scroll lists" was marked on my viewController (and not on my table view).

Here is the answer with a detailed explanation

+30
source share

In my case, this was due to the default 18 footer at the bottom of the UITableView. By setting it to 1, remove the extra space below.

+2
source share

I had this problem when I turned the UITableView upside down for the chat screen.

Before I flipped the table view, pasting the contents left an empty space at the top, so that when we scroll all the way, the contents were not blocked by the navigation bar. As soon as I turned it over, the insert was moved to the bottom.

Change your “paste content” to “Never” in the “Size Inspector” of your UITableView to get rid of this place at the end.

+1
source share

In my case, the tableView was created programmatically, and I had to set tableView.estimatedRowHeight to make the space disappear

+1
source share

in this case, you can give tableview a bottom space of 0 for its superview, and it will work, I think, or you can do,

tableView.tableFooterView = UIView();

or you can do as below

The lower value should be 1.0.

 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger )section { if(section == 0) { return 6; } else { return 1.0; } } - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger )section { return 5.0; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger )section { return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; } - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger )section { return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; } 
+1
source share

Here's how to fix this easily through Storyboard (iOS 11):

Choose View Table> Size Inspector> Insert Content: Never

0
source share

If there is a built-in navigation controller, the “show toolbar” check creates a lower span in the view controller. Just uncheck.

enter image description here

0
source share

@urgentx answer did what he wanted, but not completely. I am in a similar situation (an inverted UITableView for a chat application), but their suggestion completely disables the safe area behavior, which is undesirable on devices such as iPhone X, because this means that the table view will be cropped both by the home indicator and by any other . top navigation bars.

I did the following so that the table still correctly avoided the safe areas when upside down:

 override func viewDidLoad() { super.viewDidLoad() self.automaticallyAdjustsScrollViewInsets = false self.tableView.contentInsetAdjustmentBehavior = .never } 

and then:

 override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() //fetch the safe area in layoutSubviews since this it possible that they can change when the device is rotated let safeArea = self.tableView.safeAreaInsets //insets are **flipped** because the tableview is flipped over its Y-axis! self.tableView.contentInset = .init(top: safeArea.bottom, left: 0, bottom: safeArea.top, right: 0) } 

Essentially, this repeats the contentInsetAdjustmentBehavior =.automatic behavior, but with inserts inverted along the y axis.

0
source share

All Articles