0

I am working on feed concept, where tableview cell height need to auto adjust after image downloading , current i am facing below issueenter image description here

when you observe above image there are two labels just above the image , after downloading image labels are override by the imageview.

Actual feed should look like below

enter image description here

here i don't have height constraint for the imageview , because based on image content height will increase , for this i have applied aspect ratio for the imageview.

But after scrolling its working as expected.

please do help on this issue

Venkat Reddy
  • 111
  • 1
  • 8
  • Show your code for tableview and tablviewcell. (Look at this: https://stackoverflow.com/a/46909418/5638630) – Krunal May 21 '18 at 13:00
  • everything done which is mentioned in a link , if i have only labels then its working fine for me , problem is with the image , which is coming from server , so how can we update tableview cell height after downloading image – Venkat Reddy May 21 '18 at 13:22
  • Have you implemented `heightForRowAt`? – Rumin May 21 '18 at 14:11
  • No , i am using Constraints , so i no need to use heightForRowAt method right? – Venkat Reddy May 22 '18 at 12:29

1 Answers1

0

Give Leading, Trailing, Top and Bottom Constraints for ImageView. Top constraint to "7 days ago" label. It may work for you.

Write below lines of code in viewDidLoad()

tableView.estimatedRowHeight = Your cell default height

tableView.rowHeight = UITableViewAutomaticDimension

Parth Patel
  • 1,250
  • 1
  • 13
  • 21