ios - TableView cell not resizing after changing imageView height constraint based on Image height downloaded using SDWebImage (AUTOLAYOUT) -
i'm using autolayout.this code using under cellforrowatindexpath
:
cell.chatimage.sd_setimagewithurl(nsurl(string: newsfeed.postimage!), placeholderimage: uiimage(named: "default_profile"), completed: { (image, error, cachetype, imageurl) -> void in let height = ((image?.size.height)! / (image?.size.width)!) * (tableview.bounds.width - 16) cell.chatimageheight.constant = height self.view.layoutifneeded() })
the cell doesn't resize. resizes after scrolling. should do? since i'm using autolayout, i'm not implementing heightforrowatindexpath
. i've mentioned uitableviewautomaticdimension
, estimatedrowheight
.
i think have call self.view.setneedslayout() make whole view layout fixing constraints
cell.chatimage.sd_setimagewithurl(nsurl(string: newsfeed.postimage!), placeholderimage: uiimage(named: "default_profile"), completed: { (image, error, cachetype, imageurl) -> void in let height = ((image?.size.height)! / (image?.size.width)!) * (tableview.bounds.width - 16) cell.chatimageheight.constant = height self.view.setneedslayout() self.view.layoutifneeded() })
Comments
Post a Comment