1

I have created a UITableView using the Interface Builder I have a section footer space there, I have designed my custom view as the section footer. But I want the section footer to be hidden initially and only load it after a service call.

I have tried

self.tableview.tablefooterview.hidden = YES
self.tableview.sectionFooterHeight = 0.0f

I have also set the height in delegate methods, but the table footer view is not hiding at all. How do I hide the table footer view.

Avinash Sharma
  • 665
  • 1
  • 7
  • 23

4 Answers4

1

check this Link for how to Hide footer view in UITableView

- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section
{
    return [[UIView alloc] initWithFrame:CGRectZero];
}
d4Rk
  • 6,622
  • 5
  • 46
  • 60
Harshad
  • 2,361
  • 2
  • 18
  • 24
0

Use UITableView delegate method :-

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {

    return 0;
}
Rahul Mayani
  • 3,761
  • 4
  • 25
  • 40
0

Please try to set section footer value to more than 0(zero). I tried to set it as 0.000001 and it works.

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {

return 0.000001;
}
miOS
  • 1,379
  • 13
  • 20
-1

Please try this code

- (void)viewDidLoad
{
    self.tableview.sectionHeaderHeight = 0.0;
    self.tableview.sectionFooterHeight = 0.0;
    self.tableview.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)];
    self.tableview.tableFooterView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0;
}
Monika Patel
  • 2,287
  • 3
  • 20
  • 45