shanke shanke - 2 years ago 110
iOS Question

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

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


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

and for iOS 7

 self.yourtableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download