I have several Sections in my UITableView which sometimes can have 0 rows in it. How can i remove section header if the numberOfRowsInSection is equal to 0?
Here is my code for the sections:
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 22)];
    /* Create custom view to display section header... */
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(60, 0, tableView.frame.size.width, 22)];
    [label setFont:[UIFont boldSystemFontOfSize:14]];
    [label setTextColor:[UIColor whiteColor]];
    NSString *string =[[theLeagueArray objectAtIndex:section] objectForKey:@"league"];
    [label setText:string];
    [view addSubview:label];
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 22)];
    [imgView setImage:[UIImage imageNamed:[[theLeagueArray objectAtIndex:section] objectForKey:@"img"]]];
    [view addSubview:imgView];
    [view setBackgroundColor:[UIColor colorWithRed:13/255.0f green:78/255.0f blue:102/255.0f alpha:1.0f]];
    return view;
}
 
     
     
     
    