Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableViewSource Cells Height Always 44 Points
    primarykey
    data
    text
    <p>I am writing a custom cell for my UITableView sourced from UITableViewSource. I have implemented the GetHeightForRow and have logged the result to make sure the height comes through correctly. The problem is, my custom cell's Frame height is a fixed 44, regardless of what the value is returned from GetHeightForRow. The side effects are of course my Layer bounds are out of whack and the UITableView cuts off the bottom of my last cell and doesn't allow for scrolling any further.</p> <p>It's worth mentioning I have tried manually changing the cell's frame in my cell constructor logic and in the GetCell logic, but obvious to most, this doesn't matter, the value used always reverts to 44.</p> <p>Here is an idea of how my UITableViewSource logic goes:</p> <pre><code>public override float GetHeightForRow (UITableView tableView, NSIndexPath indexPath) { var result = SingleItemCell.GetHeight(_models[indexPath.Row], _width, _isStandalone)); Console.WriteLine(result); //prints various heights, never 44 return result; } public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(Id) as SingleItemCell ?? (_isStandalone ? new StandaloneItemCell() : new SingleItemCell()); var model = _models[indexPath.Row]; cell.Model = model; Console.WriteLine(cell.Frame.Height); //always 44 return cell; } </code></pre> <p><strong>UPDATE</strong></p> <p>Interestingly enough, the cell separators show up in the correct place, but my custom view still does not get to see the correct Frame height.</p> <p>Even after changing the constructor of my custom cell view to pass an explicit frame to the base constructor, the height of my Frame does not change.</p> <pre><code>public SingleOffer(RectangleF frame) : base(frame) //example new RectangleF(0, 0, 300, 65) { //Here, before custom logic, Frame is still 0, 0, 300, 44! Initialize(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload