Ketan
Ketan

Reputation: 497

ios: uitableview - how to remove first section

I have several sections in a uitableview as shown here:

enter image description here

How do I hide the first section header e.g. Men.

Upvotes: 1

Views: 1273

Answers (1)

Racura
Racura

Reputation: 590

Try overriding GetHeightForHeader in UITableViewSource, and returning 0 it's the first section

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
{ 
if (section == 0) return 0; 
    return tableView.sectionHeaderHeight; 
}

In Xamarin, it would look like:

public override float GetHeightForHeader (UITableView tableView, int section)
{
  if (section == 0)
    return 0;
  return tableView.SectionHeaderHeight;
}

Upvotes: 1

Related Questions