0

In a collection view, I display images of friends. And I need to display total number of friends at the bottom of the collection view.

func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int   
{
totalFriendsCount.text = " \(myProfileimages.count) Friends"

return myProfileimages.count
}

I can display total number with above code, I couldn't find a way to place the label at the bottom of all images. Appreciate your help.

OzzY
  • 221
  • 5
  • 16
  • see [this](http://stackoverflow.com/questions/26892247/custom-footer-view-for-uicollectionview-in-swift) and [this](http://stackoverflow.com/questions/29655652/how-to-make-both-header-and-footer-in-collection-view-with-swift) it helps you – Anbu.Karthik Mar 02 '16 at 16:32

1 Answers1

1

There are two options:

  1. If you don't want the label to be inside of the scrollable view of the collectionView, constrain the label to the bottom of the view, then constrain the bottom of the collectionView to the top of the label.

  2. If you want the label to only show once you've scrolled to the bottom of your collectionView, you may have create a custom UICollectionViewCell which will hold the UILabel for displaying the count.

Also see UICollectionView footers. This might help: http://www.appcoda.com/supplementary-view-uicollectionview-flow-layout/