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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -