Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
- if (![kind isEqualToString:[myGridHeaderView kind]]) {
- return nil;
- }
- myGridHeaderPosition headerPosition = [[self collectionView] headerPositionAtIndexPath:indexPath];
- CGRect cellRect = [[self delegate] getRectForHeaderAtIndex:indexPath headerPosition:headerPosition];
- if (CGRectEqualToRect(cellRect, CGRectZero)) {
- return nil;
- }
- myGridHeaderLayoutAttribute* attributes = [myGridHeaderLayoutAttribute layoutAttributesForSupplementaryViewOfKind:kind withIndexPath:indexPath];
- CGPoint centerPoint = CGPointMake(CGRectGetMidX(cellRect), CGRectGetMidY(cellRect));
- CGSize size = cellRect.size;
- UICollectionView * const cv = self.collectionView;
- NSInteger zIndex = 1;
- CGPoint const contentOffset = cv.contentOffset;
- if (contentOffset.x > 0)
- {
- if (headerPosition != myGridHeaderPositionColumn)
- {
- centerPoint.x += contentOffset.x;
- }
- zIndex = 1005;
- }
- if (contentOffset.y > 0)
- {
- if (headerPosition != myGridHeaderPositionRow)
- {
- centerPoint.y += contentOffset.y;
- }
- zIndex = 1005;
- }
- if (headerPosition == myGridHeaderPositionCommon) {
- zIndex = 1024;
- }
- attributes.zIndex = zIndex;
- attributes.headerPosition = headerPosition;
- attributes.center = centerPoint;
- attributes.size = size;
- attributes.alpha = 1.0;
- return attributes;
- }
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView
- {
- isScrollingStart=YES;
- NSLog(@"scrollViewDidScroll %f , %f",scrollView.contentOffset.x,scrollView.contentOffset.y);
- if (scrollView.contentOffset.y<=124) {
- _img_top_header.alpha=scrollView.contentOffset.y/124;
- }
- else
- {
- _img_top_header.alpha=1.0;
- }
- }
Add Comment
Please, Sign In to add comment