I am creating a table view in which there are 10 sections, all having a header view but no cells. So, in short, my table view will display 10 header views only; there will be no
Try with following code
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.25; // as for you need
}
you can also manage by following delegate method
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
Is short you can manage it by above two method.
Change the Table View style from Grouped to Plain. This solved my problem.
Try using this :
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 0;
}
As mentioned in comments, try using this :
self.tableView.rowHeight = 0;
You need to use method heightForHeaderInSection . You can also change it depending on different sections for eg. at some sections you may need to show more distance & under some, you don't want to show gap. For such case you can use CGFLOAT_MIN which is 0.000001f. Giving you an example, how you can use different section with different header heights
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if (section == 0 || section == 2) { return 55.0; } else { return CGFLOAT_MIN; } }
Hope it will help you.
Try this..
self.tableView.rowHeight = 0; // in viewdidload
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; // in viewdidload
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.01f;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return <your header height>;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return [[UIView alloc] initWithFrame:CGRectZero];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
return <your header view>;
}
Also have table seprator as none.
So I can not up vote but I can post a reply
The correct answer to this way in fact
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return CGFLOAT_MIN;
}