In the view controller, I only have a UITableView. In IB, I made the height of the header and footer equal to 1, and also added the following code, but even above the first cell there is a lot of header space. I want to get rid of this space. Even the scrollbar starts from the first cell, and not from the 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 {
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 {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width,
[self tableView:self.visitorlistsTv heightForFooterInSection:section]) ];
return view;
}
Using the above code, the bottom is hidden. But also can not hide the title.
After looking at other links for the solution, I also added a TableView to the view, added restrictions on the table view, but still part of the header is still them.
Where am I mistaken? How to get rid of it?
source
share