objective c - How to update UITableViewCell constraint's constant and update cell's height -
i've got problem self sizing cells under ios8 , autolayout (pure autolayout, no heightforrowatindexpath:).
i've got 2 uitableview subclasses. both contains kind of header (static height), footer (also static height) , "content" dynamic height. dynamic content in first 1 uilabel line number set 0 , works charm, it's set synchronously in cellforrowatindexpath (it's important!). nsstring set uilablel.text's , voila.
second type uiimageview. image downloaded asynchronously, afnetworking's uiimage category. in completion block i'm setting uiimageview's uiimage , updating calculated constraint's constant:
- it's height constraint,
- it's outlet,
uiimageview's width fixed, height calculated- height depends on image's size
now, i've tried:
- calling
layoutifneededinuitableviewcell's subclass - doesn't work @ all - setting delegete, , calling
-cellneedsupdate:(uitableviewcell *)cell, method:- reloading row @ cell's indexpath - causes strange scrolling behavior
- calling
layoutifneeded, begin/endupdates onuitableview- 1 starnge, random rows appears, cell's background color changes
- varoius combination of above - results odd behavior or doens't work @ all
is there way set without scrolling issues?
on main thread, call:
[tableview beginupdates]; [tableview endupdates]; this force tableview recalculate height visible cells.
Comments
Post a Comment