brightec / CustomCollectionViewLayout

Custom layout for a collection view using horizontal and vertical scrolling with sticky rows and columns
MIT License
519 stars 123 forks source link

Stick last section to the bottom #21

Open nipun0505 opened 6 years ago

nipun0505 commented 6 years ago

So I used this piece of code, to make the last section stick to the bottom:

if (section == [self.collectionView numberOfSections]-1)
                {
                    CGRect frame = attributes.frame;
                    frame.origin.y = self.collectionView.contentOffset.y + self.collectionView.frame.size.height - 30;
                    attributes.frame = frame;
                }

But, if the last section is pinned to bottom, the collectionview is not able to scroll. If I change frame.origin.y = self.collectionView.contentOffset.y + self.collectionView.frame.size.height - 30;, to frame.origin.y = self.collectionView.contentOffset.y + self.collectionView.frame.size.height + 70;It scrolls little bit downwards until the last section is visible and stops there.