Scroll from bottom to top

Refresh

April 2019

Views

95 time

1

Is there a way to scroll from bottom up in a collectionview so basically the first cell will be at the bottom of the screen and you scroll up to view the remaining cells

1 answers

0

To begin at the end of the UICollection view just simply use:

override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    self.collectionView!.scrollToItemAtIndexPath(indexForTheLast, atScrollPosition: UICollectionViewScrollPosition.Bottom, animated: false)
}

Or

yourCollectionView.contentOffset = CGPointMake(0, yourCollectionView.contentSize.height - yourCollectionView.bounds.size.height);

But remember to do this only when your contentSize.height > bounds.size.height.

Apple Docs