How To Scroll UICollectionView To End Of Footer or Headerby
Recently someone brought me a problem that needed my perspective. A vertical UICollectionView is using sections for displaying items. Requirement is to scroll to bottom of UICollectionView. A method that can be used used for scrolling to last item in UICollectionView is
scrollToItem(at indexPath: IndexPath, at scrollPosition: UICollectionView.ScrollPosition, animated: Bool)
Scrolls the collection view contents until the specified item is visible.
This method worked incomplete. It made collection view to last item. Isn’t that what is required? There is a custom footer at the end of section and footer needs to be visible. It did not scroll to last footer but stopped just before footer.
To find the information regarding offset on our footer view we will gather layout information for that particular supplementary view. Remember supplementary view can be either header or footer so this works for both. Here is an extension to UICollectionView