Primeiro cabeçalho da seção UITableView em branco
Eu tenho duas seções no meu UITableView. Eu gostaria que meu primeiro cabeçalho fosse inexistente, sem espaço, sem nada. A primeira célula toca o topo da tela. Eu gostaria de um cabeçalho de seção personalizada para minha segunda seção.
Eu posso fazer isso se não usar- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
mas no momento em que uso esse método, uma exibição de cabeçalho em branco aparece na primeira seção. O que estou fazendo de errado?
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if (!section == 0){
UIView *header = [[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30.0f)];
UILabel *label = [[UILabel alloc]initWithFrame:[header frame]];
[label setText:@"Test Header"];
[header addSubview:label];
return header;
}
else{
// This apparently causes a header to appear in section 0.
// Without this entire method it works fine- but it means I can't customize
// the header.
return nil;
}
}