0

I have a collection view with many different cells in it. Each cell takes up half the width of a page, and contains an image and a label under the image.

I am starting with all of the labels being truncated, along with a "Read More" button that is supposed to expand the label.

The code to do the expanding is working, but the problem is that if I click the button on a cell in the top row, and the 2nd row also has 2 cells in it, I need those 2 cells to move down the page when I click the button as well. Right now, the text is technically "expanding" but then just being truncated due to having no height left.

I believe I need some sort of invalideLayout combination with something else to make this happen, but I can't seem to piece together how I would force all of the cells to move downwards as well.

The "Read More" button is attached to a function call that updates the number of lines for that text from "3" to "0" and reloads that cell.

Thanks in advance!

Logan
  • 1,172
  • 9
  • 23
  • Possible duplicate of [UITableview : Change cell height dynamically when clicked the custom button](https://stackoverflow.com/questions/39673583/uitableview-change-cell-height-dynamically-when-clicked-the-custom-button) – jpetrichsr Dec 28 '17 at 19:50
  • It would be really helpful if you posted your code. – DoesData Dec 28 '17 at 20:13
  • I assume you're using `sizeForItemAtIndexPath` to determine the cell size, and when it should expand it returns a different value. Then you would need to call the CollectionView's `reloadItems` method to redraw the cell. – Michael Dec 29 '17 at 03:51

0 Answers0