Add button at end of collection view in storyboard
In the storyboard, you can enable it by selecting the "Footer" radiobook title for your UICollectionView and then dragging the UIButton there. You can also override this function:
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
You may also need to set the reference size of the footer if you UICollectionViewFlowLayout
source to share
Swift 2.1 Solution:
In the storyboard, select Collection View > Attributes Inspector > Enabled Section Footer
Once this is enabled, the section view will appear and you can drag your views onto it.
Select the header view, and set the Identifier
... ex:FooterViewID
Next, in your view controller file, write:
func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
let footerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "FooterViewID", forIndexPath: indexPath)
return footerView
}
The footer should now appear at the bottom of the interface.
source to share