ios - Tableview Cell dynamic height with images -
i have tableview takes full width & height of current controller. each cell contains image, taking full width of tableview.
what don't know size of image, need not cropped or stretched.
what need cell resize depending on image it's holding. image loaded using sdwebimage internet after cell created.
i've seen many ridiculous answers everywhere hardcoding values or else imagine following same thought process, out of question here.
i've tried using
tableview.rowheight = uitablevies.dynamicdimension; tableview.estimatedrowheight = afloatvalue;
but not work expected.
when cells loaded, heights matching image, image not fill full width. it's not because there gap on side.
then after scrolling away rescrolling cell, resize abruptly (and it's visually not acceptable) take full width should cell resizes way far in terms of height, , @ point there gap between cells.
so solution has 2 problems : cell resize reason, late, , before , after each resize, there size problem.
see attached images clarity.
the resize happens when cell reloaded, , pushes whole tableview down, makes sudden , abrupt move iamges , not acceptable.
Édit : - can not ask image size image. - constraints top bottom leading , trailing superview's borders @ 0 - image way larger cell, it's sized down sure. - image supposed take full width, , want height of cell height of image. height of image whatever number when image keeps aspect ratio when taking full width
Comments
Post a Comment