Instagram / Instagram/IGListKit

section displays under cells that their zIndex are greater than 1000

Open
#1,227 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
13.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

## New issue checklist

- [x] I have reviewed the [`README`](https://github.com/Instagram/IGListKit/blob/master/README.md) and [documentation](http://instagram.github.io/IGListKit)
- [x] I have searched [existing issues](https://github.com/Instagram/IGListKit/issues) and this is not a duplicate

### General information

- `IGListKit` version:
- iOS version(s):
- CocoaPods/Carthage version:
- Xcode version:
- Devices/Simulators affected:
- Reproducible in the demo project? (Yes/No): Yes, return the itemsCount greater than 1000 with stickyHeader `true`
- Related issues:

### Debug information

```bash
# Please include debug logs using the following lldb command:
po [IGListDebugger dump]

```

when there are over 1000 cells, the cells that the indexPaths are greater than 1000 would display over section header
for example,
In section 0
when indexPath.item == 1000, the zIndex of this cell is 1000,
the zIndex of the header is 999, that means header displays under cells

## IGListCollectionViewLayout.mm LINE:123
```
static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attributes) {
const NSInteger maxZIndexPerSection = 1000;
const NSInteger baseZIndex = attributes.indexPath.section * maxZIndexPerSection;

switch (attributes.representedElementCategory) {
case UICollectionElementCategoryCell:
attributes.zIndex = baseZIndex + attributes.indexPath.item;
break;
case UICollectionElementCategorySupplementaryView:
attributes.zIndex = baseZIndex + maxZIndexPerSection - 1;
break;
case UICollectionElementCategoryDecorationView:
attributes.zIndex = baseZIndex - 1;
break;
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.