1

As you can see here, I have only 2 data for testing and they are loaded into the table view . This is good. But, there are many empty cells have also been automatically generated.

How to make these empty cells invisible?

enter image description here

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
ske
  • 4,694
  • 3
  • 23
  • 35
  • Duplicate Question: http://stackoverflow.com/questions/1633966/can-i-force-a-uitableview-to-hide-the-separator-between-empty-cells http://stackoverflow.com/questions/14460772/how-to-hide-remove-separator-line-if-cells-are-empty http://stackoverflow.com/questions/1369831/eliminate-extra-separators-below-uitableview-in-iphone-sdk – Mrunal Jun 05 '14 at 13:09

3 Answers3

3
yourtableViewname.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

or

    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 
 { 
     return 0.01f;
 }

and for iOS 7

 self.yourtableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
2

This should work :

self.tableView.separatorColor = [UIColor clearColor];
self.tableView.backgroundColor = [UIColor clearColor];
streem
  • 9,044
  • 5
  • 30
  • 41
1

You can reduce the overall height of the tableview when your view is loaded. Calculate the height of the the table view based on total cell height. Assign the table height max to screen height.

meremortal
  • 11
  • 2