Changing the height of a collectionView Cell with animation

193 views Asked by At

The cells with the blue bar are the cell I want to change the height for based on how many green cells there are.

Right now I can make the cell change size but looks really choppy I do this by using,

 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  
    return CGSize(width: 400, height: (50 * actionSteps[indexPath.row].SubActionSteps.count) + 100)
}

Is there any way to animate the change in height?

1

There are 1 answers

0
aheze On BEST ANSWER

Try this:

actionSteps[indexPath.row].SubActionSteps.append("") /// or whatever you're currently doing
collectionView.performBatchUpdates(nil, completion: nil)