I am trying to implement a UICollectionViewCell
that includes a UITextView
that resizes during runtime as the amount of text a user enters in it increases, as well as moves the cells above it up or down based on the size of the text box. (This UICollectionView
is implemented with the UICollectionViewDelegateFlowLayout
)
I am able to resize the actual cell during runtime while the user is entering text into the cell through the textViewDidChange()
method of the UITextViewDelegate
. However this does not change the position of the other cells, as collectionView(\_:layout:sizeForItemAt:)
is not called immediately. I am able to trigger collectionView(_:layout:sizeForItemAt:) if I call reloadData()
within the UICollectionView
class, which repositions the other cells relative to the one of interest, but the problem with this is that this reloads the all the objects, and the keyboard that immediately closes.
Is there a way to trigger collectionView(_:layout:sizeForItemAt:)
without calling reloadData()
?
Another question that is getting at what I want to know is Resize CollectionView Cell during runtime without reloading but their question is not answered either.