简体   繁体   中英

tableView cell dynamic height only works properly after some scrolling

I'm trying to set the height of my tableview cell based on the height of an image inside my cell, the cell is rendering properly if I scroll a little up and down otherwise it is not getting updated, I have set all necessary constraint the image view (leading, trailing, top, bottom).

and i'm setting the image in my cellforrowat I have set rowHeight as UITableViewAutomaticDimension

I have tried these solution
1. aspect constraint 2. dynamic cell height scrolling issues solutions

  1. make sure you have set top-bottom constraints in storyboard.
  2. save the thumbnail image as data to local storage (I'm using core data)
  3. using the thumb image, calculate the aspect of the image
  4. customise the row height as you want in heightForRowAt method.

I have answer this here: https://stackoverflow.com/a/61768782/7514688

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM