After updating my phone to iOS 14, I can no longer interact with content within UICollectionViewCell
or within UITableViewCell
for my app. The issue is also present in iOS simulators running iOS 14, but everything works fine with iOS 13 and below.
I have buttons and other collection views within the cells that are no longer interactable. It's as if the entire cell content has become static. Below is some code from my UICollectionViewCells
and UICollectionViewController
, however the same issue is present in UITableViewCells
. I am using Swift 5. didSelectItemAt
and similar functions work fine, it's interacting within the cell's contentView
specifically that appears to not be working. I can paste more code if necessary as I trimmed some fluff and other code I have narrowed down to not be a problem.
Since the issue is present in both UICollectionViewCell
and UITableViewCell
I believe I am doing something wrong at a more fundamental level.
Relevant code from the UICollectionViewCell
:
override init(frame: CGRect) {
super.init(frame: frame)
setupContainers()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupContainers() {
// Adding subviews like so...
addSubview(subviewToAdd)
// Anchor all subviews using NSConstraints
}
And then relevant code from the UICollectionViewController
override func viewDidLoad() {
super.viewDidLoad()
setStyleAndDelegates()
}
private func setStyleAndDelegates() {
collectionView?.backgroundColor = UIColor.white
collectionView?.delegate = self
collectionView?.dataSource = self
collectionView?.register(MyCell.self, forCellWithReuseIdentifier: eventCellId)
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: eventCellId, for: indexPath) as! MyCell
return cell
}
EDIT:
Upon further inspection of the view hierarchy, there is an additional UIView
placed directly on top of all content in the cell in iOS 14. In iOS 13, this view is not there. Pictures attached below.