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 layoutifneeded in uitableviewcell'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 on uitableview - 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

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -