From 6b2bbdc45e9c69a85c859661ac3e9669e989b072 Mon Sep 17 00:00:00 2001 From: James Tang Date: Sat, 6 Jun 2015 00:39:00 +0800 Subject: [PATCH 1/2] refs #68 fixes issue where scroll indicator was overlapped by cells and section header --- Classes/CSStickyHeaderFlowLayoutAttributes.m | 6 +++++- .../CSStickyHeaderFlowLayoutDemo/Base.lproj/Main.storyboard | 6 +++--- .../CSLockedHeaderViewController.m | 4 ++++ .../CSParallaxHeaderViewController.m | 5 +++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Classes/CSStickyHeaderFlowLayoutAttributes.m b/Classes/CSStickyHeaderFlowLayoutAttributes.m index ca7777c..39e261c 100644 --- a/Classes/CSStickyHeaderFlowLayoutAttributes.m +++ b/Classes/CSStickyHeaderFlowLayoutAttributes.m @@ -23,7 +23,11 @@ - (void)setZIndex:(NSInteger)zIndex { // https://github.com/jamztang/CSStickyHeaderFlowLayout/issues/68#issuecomment-108678022 // Reference: UICollectionView setLayout:animated: not preserving zIndex // http://stackoverflow.com/questions/12659301/uicollectionview-setlayoutanimated-not-preserving-zindex - self.transform3D = CATransform3DMakeTranslation(0, 0, zIndex); + + // originally our solution is to translate the section header above the original z position, + // however, scroll indicator will be covered by those cells and section header if z position is >= 1 + // so instead we translate the original cell to be -1, and make sure the cell are hit test proven. + self.transform3D = CATransform3DMakeTranslation(0, 0, zIndex == 1 ? -1 : 0); } @end diff --git a/Project/CSStickyHeaderFlowLayoutDemo/Base.lproj/Main.storyboard b/Project/CSStickyHeaderFlowLayoutDemo/Base.lproj/Main.storyboard index 6596fe8..3af57fb 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo/Base.lproj/Main.storyboard +++ b/Project/CSStickyHeaderFlowLayoutDemo/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -286,7 +286,7 @@ - + diff --git a/Project/CSStickyHeaderFlowLayoutDemo/CSLockedHeaderViewController.m b/Project/CSStickyHeaderFlowLayoutDemo/CSLockedHeaderViewController.m index 631bef1..d718350 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo/CSLockedHeaderViewController.m +++ b/Project/CSStickyHeaderFlowLayoutDemo/CSLockedHeaderViewController.m @@ -167,6 +167,10 @@ - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView return nil; } +#pragma mark UICollectionViewDataSource +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"hit test"); +} @end diff --git a/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m b/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m index cf16999..64cad72 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m +++ b/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m @@ -113,5 +113,10 @@ - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView return nil; } +#pragma mark UICollectionViewDataSource + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"hit test"); +} @end From 01f0e6189923603d91cee8c896659e52ce6526c2 Mon Sep 17 00:00:00 2001 From: James Tang Date: Sat, 6 Jun 2015 01:03:47 +0800 Subject: [PATCH 2/2] 0.2.7 --- CSStickyHeaderFlowLayout.podspec | 2 +- README.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CSStickyHeaderFlowLayout.podspec b/CSStickyHeaderFlowLayout.podspec index f0c5ae8..bc3cb5c 100644 --- a/CSStickyHeaderFlowLayout.podspec +++ b/CSStickyHeaderFlowLayout.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CSStickyHeaderFlowLayout" - s.version = "0.2.6" + s.version = "0.2.7" s.summary = "Parallax and Sticky header done right using UICollectionViewLayout" s.description = <<-DESC UICollectionView are flexible and you can use supplementary views to diff --git a/README.md b/README.md index 9a8b3a5..d15d631 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ If you think this worths something, tip me a cup of coffee! (p.s. was trying out ## Updates +- 0.2.7: Fixed scroll indicator covered by cell + - 0.2.6: Fixing that section header being covered by cell after perform batch update - 0.2.5: Fixing a crash when quickly popping back to a view controller using the parallax header