I am trying to implement auto resizing UITableViewCell by auto layout. I have Table View Prototype cell (Custom Cell).
I have one UIImageView which has TopSpace, BottomSpace, LeadingSpace to view, Height & Width as constraints.
I have UILabel Which has Top, Horizontal space to UIIMage View Trailing Space to view and vertical space to UILabel at bottom.
I have another UILabel which has Horizontal Space to UIImage View Trailing space to view and bottom space.
I have set Lines to 0. for both label and added
self.tblview.estimatedRowHeight = 80.0f;
self.tblview.rowHeight = UITableViewAutomaticDimension;
Also i have following code in cellForRowAtIndexPath
[cell setNeedsUpdateConstraints];
[cell updateConstraintsIfNeeded];
[cell setNeedsLayout];
This is not working for first time but when i scroll down and scroll up auto sizing works like a charm.
Can any one please help me here ?
preferredMaxLayoutWidthfor the label in storyboard. - gabbler