ske
ske

Reputation: 5264

IOS Dev - How to make those empty table cells invisible?

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

Upvotes: 1

Views: 226

Answers (3)

meremortal
meremortal

Reputation: 11

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.

Upvotes: 1

streem
streem

Reputation: 9144

This should work :

self.tableView.separatorColor = [UIColor clearColor];
self.tableView.backgroundColor = [UIColor clearColor];

Upvotes: 2

Anbu.Karthik
Anbu.Karthik

Reputation: 82759

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];

Upvotes: 3

Related Questions