ios - Configuring TableView with automatic cell height results in no cells displayed -


my goal use uitableviewautomaticdimension show cells dynamic heights in tableview. @ moment, no cells show in tableview after enabling uitableviewautomaticdimension.

here current configuration:

  1. i using custom cell class, called feedcell
  2. feedcell has view called foregroundcontainerview, has been configured such sides pinned. enter image description here
  3. i have tried pin contentview of cell, unable to: enter image description here
  4. lastly, have following in viewdidload:

    self.tableview.rowheight = uitableviewautomaticdimension self.tableview.estimatedrowheight = 112.0

(i deleted default function func tableview(_ tableview: uitableview, heightforrowat indexpath: indexpath) -> cgfloat

if don't use uitableviewautomaticdimension, cells appear normally, confirming data fed tableview correctly.

what doing wrong? pointers appreciated.

i think constraints ambiguous. asking uikit automatically size cell (uitableviewautomaticdimension), "foreground container view" not have defined height...it constrained cell (which doesn't have defined height!).

so have kind of ambiguous constraint warning in console since system doesn't know do, or it's possible "foreground container view" defaulting height of 0.0 meaning table cell height 10.5 (0.0 + constrained spacing). didn't include screenshot of shows in simulator, i'm guessing.

give "foreground container view" content or explicitly constrain it's height able see (ex. 200px). recommend give background color can see it's height on screen.


to automatic cell sizing actual cell content, should constrain views (labels, images, whatever else) inside "foreground container view" (or if want, inside cell's content view directly).

there must both top spacing , bottom spacing constraint between anticipated tallest subviews (labels, images, etc.) , container.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -