In a view controller I have only a UITableView. In IB I have made Header & Footer height as 1, and have also added the following code but yet above the 1st cell their is lots of space of header. I want to get rid of that space. Even the scrollbar starts from the 1st cell and not on top.
-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
CGFloat height = 0.0001;
return height;
}
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
CGFloat height = 0.0001;
return height;
}
-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
// Create Empty View
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width,
[self tableView:self.visitorlistsTv heightForHeaderInSection:section]) ];
return view;
}
-(UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
// Create Empty View
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width,
[self tableView:self.visitorlistsTv heightForFooterInSection:section]) ];
return view;
}
With the above code, the footer part is hidden. But can't get the header hidden too.
Looking at other links for solution I have also added TableView in a View, have added constraints to the tableview, but still the header part is still their.
Where am I going wrong ? How to get rid of it ?