I create a custom cell PVIssueTypeSectionHeaderCell
and add it as a subview for ContentView
in the header view with this code:
public override UIView GetViewForHeader(UITableView tableView, nint section)
{
var cell = (PVIssueTypeSectionHeaderCell)tableView.DequeueReusableCell(HeaderCellKey);
if(cell == null)
{
cell = PVIssueTypeSectionHeaderCell.Create();
}
cell.ViewModel = this.GroupedIssueTypesFilter.ElementAt((int)section);
var headerView = tableView.DequeueReusableHeaderFooterView(HeaderFooterViewKey);
if (headerView == null)
{
headerView = new UITableViewHeaderFooterView(HeaderFooterViewKey);
}
headerView.ContentView.AddSubview(cell);
return headerView;
}
But the custom cell's width does not auto-resize as you could see in these images below.
This is in iPad Landscape mode and in iPhone Portrait mode:
While this one is in iPad Portrait mode:
How to make the custom cell automatically resize its width?