I am re-writting an objective-C app of min in swift and decided that a collection view works better then a tableview in my case. So i have the collectionview all set up exactly how i want it and now i need to add a footer to my collection view.
In objective-C it was very easy for me, all i did was create a UIView, add objects to it, and add it to my tableview like this.
self.videoTable.tableFooterView = footerView;
Now i've been trying in my collection view to get a similar solution, however i've had no luck so far.
Is there a simple .collectionviewFooterView
or something that i can add my UIView to?
EDIT
i found similar ideas HERE if that helps create an answer
EDIT
I've been thinking on ways to achieve this so right now my idea is to add the footer view to the end of the collection view using the following code:
var collectionHeight = self.collectionView.collectionViewLayout.collectionViewContentSize().height
footerView.frame = CGRectMake(0, collectionHeight, screenSize.width, 76)
The only issue i'm having with this workaround is i need to add more space to the contentView of the colletionView and i am having no luck with that
My Solution
I solved it using a work-around (not the prettiest but it works), i add the UIView to the uicollectionview using a simple
footerView.frame = CGRectMake(0, collectionHeight - 50, screenSize.width, 50)
self.collectionView.addSubview(footerView)
and set the layout insets using this:
alLayout.contentInsets = UIEdgeInsetsMake(2, 2, 52, 2)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…