0

My situation is that I have a collectionView which has two types of cells. The first cell type is a simple editable UITextField, then second contains a UITableView with editable UITextFields inside its cells.

My problem is that when the keyboard shows up due to the text fields inside the a table view cell and I change contentInset the change does not take place.

This is the code I am using to change the insets when the keyboard appears and its the same code for when the textfield in the collection view cell is selected, which works.

self.view.setNeedsLayout() 
self.collectionView.contentInset.bottom = inset
self.view.layoutIfNeeded()

There must be something that I can't think of that is preventing contentInsets to change.

I also have a custom UICollectionViewLayout although I don't think this matters as that is only concerned with the contents of the collectionView, not the insets.

Any help would be much appreciated.

1 Answer 1

0

Turns out the reason it was working was because the cell with the textview in it was doing some magic autoscroll, while the cell with the table view textview was not, I'm guessing as it was to far nested in the view stack to handle this.

My fix was to adjust the contentOffset so as to force a scroll.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.