objective c - iOS UITableViewCell autosizing bug -


i've uitableviewcell designed .xib use cell autosizing. in ios 9 works well, in ios 8 cell doesn't expands itself, , label inside remains 1 line of text. if cell go away screen , came (i.e. after scrolling) label ok.

ideas? think ios 8 bug.

enter image description here enter image description here

i had faced same problem. if constraints set need set preferredmaxlayoutwidth each uilabel have in cell, before return cell. here example code

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"];     cell.lbltitle.text = @"n";     cell.lbldetails.text = @"bla bla";     cell.lblother.text = @"other text";       // configure cell...     cgfloat leftpading =// "your logo width + spacing between logo , label"     cgfloat rightpading = //your label trailing space     cell.lbltitle.preferredmaxlayoutwidth = cgrectgetwidth(tableview.bounds)-(leftpading +rightpading);     cell.lbldetails.preferredmaxlayoutwidth = cgrectgetwidth(tableview.bounds)-(leftpading +rightpading);      [cell setneedsupdateconstraints];     [cell updateconstraintsifneeded];      return cell;     } 

have @ know how put constrains properly

hope helps you.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -