From bbd4738ca20759d24549319de6fda0e7b3d49d17 Mon Sep 17 00:00:00 2001 From: PhilCai Date: Fri, 17 Mar 2017 08:07:37 -0700 Subject: [PATCH] Simplify header height check in layout Summary: Issue fixed: # - [ ] All tests pass. Demo project builds and runs. - [ ] I added tests, an experiment, or detailed why my change isn't tested. - [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Small changes Closes https://github.com/Instagram/IGListKit/pull/565 Differential Revision: D4728939 Pulled By: rnystrom fbshipit-source-id: 4f0c3455f55d4c267dffe5d7ebd37a96a648ec52 --- Source/IGListCollectionViewLayout.mm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/IGListCollectionViewLayout.mm b/Source/IGListCollectionViewLayout.mm index 6a8442a3..c9617563 100644 --- a/Source/IGListCollectionViewLayout.mm +++ b/Source/IGListCollectionViewLayout.mm @@ -139,10 +139,8 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut // do not add zero height headers or headers that are outside the rect const CGRect frame = attributes.frame; const CGRect intersection = CGRectIntersection(frame, rect); - if (!CGRectIsEmpty(intersection) || CGRectGetHeight(frame) == 0.0) { - if (CGRectGetHeight(frame) > 0.0) { - [result addObject:attributes]; - } + if (!CGRectIsEmpty(intersection) && CGRectGetHeight(frame) > 0.0) { + [result addObject:attributes]; } }