Closed maxim04 closed 7 years ago
adapter.performUpdates()
looks at the the diffIdentifier
and the isEqualTo:diffableObject
methods to identify if a section controller needs reloading. You can include your transform in the isEqualTo:diffableObject
method to determine if the view model has changed.
@maxim04 to apply transforms to the cells, you might want to use IGListDisplayDelegate
and apply your transform in willDisplay
like this.
It also might be more technically correct to do this sort of stuff in a UICollectionViewLayout
.
@rnystrom tried to apply the transform in listAdapter(_ listAdapter: IGListAdapter, willDisplay sectionController: IGListSectionController, cell: UICollectionViewCell, at index: Int)
and still the same thing happening, the transform is only applied when the cell comes from offscreen to onscreen, the already onscreen sections don't have the correct transform.
I'm using IGListKit in conjunction with SlackTextViewController if that gives more context, hence why i'm trying to apply the inverted transform.
Oh, I've actually never gotten the inverted transform to work with UICollectionView. I believe if you want that to work you'll have to do it all through a custom layout.
To make an inverted table work for me, in the cellForItem:atIndex
method, I've added a transform like so: cell.transform = cell.transform.scaledBy(x: 1, y: -1)
(you may need to set the identity at reuse so you don't keep flipping it). I've also added my collection view as the "arbitrary scroll view managed by SlackTextViewController" in the init(scrollView:)
initializer for the SlackTextViewController. But yeah, probably best to have it in a custom layout.
After a lot of trial and error i managed to get the inverted UICollectionView to work. The trick was to apply the transform to cell.contentView
instead of the cell
, i also did this in cellForItem(at index: Int)
. Now the already on screen sections have the correct transform, as well as the offscreen ones.
New issue checklist
README
and documentationGeneral information
IGListKit
version: MasterHi all, i am getting data from a rest api, after getting the data i append it to the data array and call adapter.performUpdates(). I apply a transform to the cells in the sectionController, but the visible sectionController's layout is not updated until the state of the section changes from offScreen -> onScreen.
This can be reproduced in the example project in the
Tail Loading
example by applyingcell.transform = CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: 0)
in theLabelSectionController
, newly added visible cell's will not have the correct transform until they go offScreen -> onScreen.Can anybody guide me in the correct direction here, much appreciated.