shanke shanke - 6 months ago 15
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
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];
Comments