在故事板中的集合视图末尾添加按钮 [英] Add button at the end of collection view in storyboard
问题描述
我在故事板中有一个 UICollectionViewController
。我知道如何添加单元格并修改它们但由于某些原因我无法在 UICollectionView
之后添加任何其他视图或UI元素。
I have a UICollectionViewController
in a storyboard. I know how to add cells and modify them but for some reason I can't add any other view or UI element after my UICollectionView
.
有没有办法在故事板中这样做?如果不能如何以编程方式执行此操作?
Is there a way to do this in the storyboard? If not how can I do this programmatically?
推荐答案
在故事板中,您可以通过选择单选按钮标题Section Footer来启用它,为您的UICollectionView,然后在那里拖动UIButton。你也可以覆盖这个函数:
In storyboard you can enable it by selecting the radio button title "Section Footer", for your UICollectionView and then by dragging UIButton there. You can also override this function:
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath :( NSIndexPath *)indexPath
如果您是 UICollectionViewFlowLayout $ c $,您可能还需要设置页脚的引用大小c>
这篇关于在故事板中的集合视图末尾添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!