SeanT SeanT - 5 months ago 39
iOS Question

UICollectionViewCell scrolls when UITextView is tapped, doesn't scroll back when keyboard dismissed

I have a

UITextView
in a
UIScrollView
in a
UICollectionViewCell
, and when I tap it, everything scrolls up for the keyboard, but it never scrolls down when I close the keyboard.

This problem only occurs when everything is inside a
UICollectionViewCell


I have not added any code to cause the scrolling up, in fact the
UICollectionViewCell
isn't even a delegate of the
UITextView


Has anyone run into this? Or does anyone know how to disable it from scrolling up altogether when the keyboard appears?

Thanks for any help...

Answer

I found the answer to this finally. I thought that because my UICollectionViewCell has a UIScrollView in it, that the content in the UIScrollView was being scrolled up. What was actually happening was the UICollectionView was actually moving the frame of the entire UICollectionViewCell up 200 pixels when the keyboard appeared, but wasn't moving it back down when the keyboard disappeared, so I just made the UICollectionViewCell a delegate of the UITextView and when it ended editing I reset the cell's origin to (0, 0)

Comments