uitableview - Unable to get dynamic table cell size working in XCode 6 iOS 8 -
i'm trying adopt adaptive layout in new app , have learned quite bit. last portion had dump text table , have cells adjust stay adaptive, seemed easy enough.
i read through few tutorials , ios 8 looks comes down 2 things:
- having estimatedrowheight , rowheight = uitableviewautomaticdimension set
- having constraints set right create pressure on cell itself
shamefully entire day has gone out window trying master mere 2 points... downloaded code provided keith harrison on self sizing table view cells see work. duplicated cell larger project , worked, none of own cells worked. deconstructed in project , minimized point little left tried making similar cell scratch. i've gone through , verified every constraint, every hugging/resistance setting, etc, , yet mine fail expand cell height.
if can point out i'm doing wrong (and must tiny because see same) have uploaded minimized version of example here (github).
with example tried cell single multiline label constraints around along cell close possible cell. found in many of attempts looked identical uiview-encapsulated-layout-height
constraint issue. last attempt reduced priority of vertical spacing content container 999 1000.
things have checked or tried no effect:
- contraints superview (content container, not cell)
- label set 0 lines
- hugging , resistance priorities same working cells
- reloading table once loaded
i have solution working after long stab @ it. 2 things:
- the uitableviewcells, while identical in every way in storyboard had
rect
tag within storyboard source defined width , height. looked everywhere values in ib no luck. taking out fixed problem github test project posted. - after moving on project working on cells still not resizing, when orientation changed. had add
cellforrowatindexpath
method callsetneedsdisplay
,layoutifneeded
on cell being requested.
following above appears working.
Comments
Post a Comment