In my app I have a tableView which contains several cells with UICollectionView, The layout of UICollectionView is custom and set in cellForRowAtIndexPath.
In prepare method of collectionViewLayout I set a default contentOffset to collectionView.
But this contentOffset only works for visible table cells and when I scroll tableview other cells do not have this default content offset.
How to fix this issue ?
override func prepare() {
guard cache.isEmpty, let collectionView = collectionView else {
return
}
// ...
// Prepare cell attributes and add to cache array
// ...
collectionView.contentOffset = CGPoint(x: 100, y:0)
}