简体   繁体   English

iOS6 UIStoryboard如何将UICollectionReusableView添加到UICollectionView对象?

[英]iOS6 UIStoryboard how to add a UICollectionReusableView to a UICollectionView object?

I'm running into a silly issue when working with a UICollectionView - I've added a " UICollectionReusableView " by dragging it to within the UICollectionView at the top position. 使用UICollectionView时遇到一个愚蠢的问题-我通过将其拖到顶部的UICollectionView中添加了“ UICollectionReusableView ”。 I'm expecting that this is a kind of a header that would be visible (similar to UITableView ). 我期望这是一种可见的标头(类似于UITableView )。 However, when I run the app, I see a blank space of height equal to that of the reusable view over the cells, but nothing else is showing. 但是,当我运行该应用程序时, 我看到一个高度等于空格的可重复使用的视图的空白区域 ,但没有其他显示。

What other steps do I need to take to make sure that my reusable view, defined in storyboard shows up when the app is running? 为了确保在应用运行时显示在情节提要中定义的可重用视图,我还需要采取什么其他步骤?

您需要子类化UICollectionResusableView并实现-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)种类atIndexPath:(NSIndexPath *)indexPath {

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM