Skip to content

On vertical scroll with sections, unexpected behaviour. Cells appear in front of others  #64

@Johnathan-Aretos

Description

@Johnathan-Aretos

When sections are being used it breaks the logic

attributes.zIndex = attributes.indexPath.row -> PageAttributeAnimator.swift

Given a zIndex will determine depth when using indexPath values e.g [0,1], sections, row respectively. We run into issues when the section resets.

I don't know of a cleaner solution, but what I've been using at the moment is

var section = attributes.indexPath.section
var numItems = 0

while section >= 0 {
    numItems += collectionView.numberOfItems(inSection: section)
    section -= 1

attributes.zIndex = attributes.indexPath.row + numItems

Which seems to be doing the trick, my run into performance issues when using larger data sets. A more elegant solution will be to use visible cells and work out within the two cells an appropriate zIndex.

Happy for suggestions to make a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions