'How to make stacking effect (like notifications screen) using UICollectionView?
I want to make cells stack like this.

What I'm ended up doing is reverse zPotision
cell.layer.zPosition = -indexPath.row;
and decrease the distance between each cell
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
return -self.cellHeight + 15;
}
and make cells smaller base on the order
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGFloat size = (indexPath.row * [[UIScreen mainScreen] bounds].size.width) / 20;
return CGSizeMake([[UIScreen mainScreen] bounds].size.width - size, self.cellHeight);
}
but this seems not going to work because
- For some reason, I can't tap on the first cell's button, seems like something is blocking it.
- If it's possible (just an extra question, my main problem is the first one), I want to make it rotate like this but I'm not sure where can I add those codes.
and the fold/unfold animation on the notification screen is smoother too.
Is there any better way to do this? I feel like what I'm doing is not the correct way.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
