iOS 14 UICollectionView in UICollectionViewCell or UITableViewCell doesn't receive touches and is unable to scroll

Up until iOS 14, I was able to put a UICollectionView in a UICollectionViewCell or UITableViewCell, while achieving horizontal scroll and touches to the embedded UICollectionView's cells.

Recently upgraded to iOS14 and updated to Xcode 12 and that functionality is now not working for my app?

Is this a bug or is there a workaround?

Replies

In the case of adding a UICollectionView to a UICollectionViewCell, it works for iOS 14. However, in the case of adding a UICollectionView to a UITableViewCell, the work around I found was to add it as a subview to the contentView instead of a subview of the cell.
iamcR, Thank you!! You nailed it!!
Hi,

Our team is experiencing the same issue. We have a vertical collection view inside a collection view cell and prior to iOS 14 everything was working fine. After installing iOS 14, we are seeing that the collection view is not scrollable and we can't interact with any of the buttons.

https://stackoverflow.com/questions/64376331/does-ios-14-have-some-breaking-changes-that-disable-vertical-scroll-for-collecti
Confirm answer of iamcR.
I was holding collection view inside UITableViewCell.
Code Block objective-c
[self addSubview:self.collectionView];

Changing it to
Code Block objective-c
[self.contentView addSubview:self.collectionView];

helped in iOS 14 and didn't break anything in iOS 13.

Thank you iamCR! I was also having similar issues with a collection view inside a collection view cell. Layout size tended to be initially correct but upon rotating two times, the size of the layout would be broken. Adding the collection view to the content view and adding autolayout constraints to it did the trick. Tested on iOS 15 *