iOS Auto-resize custom cell width in UITableViewHeaderFooterView.ContentView Subview
<p>I create a custom cell <code>PVIssueTypeSectionHeaderCell</code> and add it as a subview for <code>ContentView</code> in the header view with this code:</p>

<pre><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;
}
</code></pre>

<p>But the custom cell's width does not auto-resize as you could see in these images below.</p>

<p><strong>This is in iPad Landscape mode and in iPhone Portrait mode:</strong></p>

<p><a href="https://i.stack.imgur.com/b6F0F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b6F0F.png" alt="ipad landscape/iphone portrait"></a></p>

<p><strong>While this one is in iPad Portrait mode:</strong></p>

<p><a href="https://i.stack.imgur.com/1AOB0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1AOB0.png" alt="ipad portrait mode"></a></p>

<p>How to make the custom cell automatically resize its width? </p>