Questions tagged [uicollectionreusableview]

The UICollectionReusableView class defines the behavior for all cells and supplementary views presented by a collection view.Available in iOS 6.0 and later. It should be tag only issues related with [tag:uicollectionreusableview].

UICollectionReusableView : Reusable views are so named because the collection view places them on a reuse queue rather than deleting them when they are scrolled out of the visible bounds. Such a view can then be retrieved and repurposed for a different set of content.This is declared in Apple's UIKit framework and available in iOS 6.0 and later

This class is intended to be subclassed. Most methods defined by this class have minimal or no implementations. You are not required to override any of the methods but can do so in cases where you want to respond to changes in the view’s usage or layout.

Source: UICollectionReusableView Class Reference

Related tags:

Related Stack Overflow questions:

  1. Removing empty space, if the section header is hidden in the UICollectionView

  2. How to detect scrolling to a new section in a UICollectionView?

191 questions
5
votes
1 answer

UICollectionReusableView for section header not working

I created a UICollectionReusuable view for UICollecton view section header. I use the following code the implement the header view. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView…
Subash
  • 1,002
  • 13
  • 26
5
votes
1 answer

Custom Header in UICollectionView with Interface Builder without Storyboard

I'm trying to add a custom view to the header section of my UICollectionView. I have the xib file interface builder but I don't use storyboard. I have checked the Section Header in Interface Builder but doesn't appear any UICollectionReusableView,…
Piero
  • 9,173
  • 18
  • 90
  • 160
4
votes
1 answer

CollectionViewSection Inset Does Not Consider Header/Footer Views

I have a collectionView with headers and footers. I want to add spacing at the end of the section. I am using: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section:…
4
votes
2 answers

viewForSupplementaryElementOfKind is not setting the label text until Collection View is scrolled

I'm using viewForSupplementaryElementOfKind to generate a header in my Collection View. The header (SectionHeader) is a Section Header accessory in Storyboard that simply just contains 1 outlet. class SectionHeader: UICollectionReusableView { …
4
votes
1 answer

Collection view within another collection view: section header or cell?

I already have a UICollectionView which scrolls vertically and shows a collection of custom UICollectionViewCells which have a fixed size. Now I've been asked for showing another UICollectionView in top of all other cells, which should scroll…
4
votes
1 answer

How do I reload cells in UICollectionView without reloading the header?

I am trying to update the content of the cells in a UICollectionView based on what the user inputs into a textField in the header. I have looked at other similar questions here but none of their answers have seemed to work.I even tried implementing…
4
votes
1 answer

Swift 3 UICollectionView reusable section header will not display

In swift 3 with Xcode 8.2 I can't get a reusableHeaderView to display with UICollectionView. I placed breakpoints at various points in my header view file and they are never tripped. Here is my code. import UIKit class WishListViewController:…
markhorrocks
  • 1,199
  • 19
  • 82
  • 151
4
votes
2 answers

How can UICollectionView supplementary views be inserted or deleted correctly

Short question: Is there a way to add and remove supplementary views like cells and section in a performBatchUpdates: block similar to the insertItemsAtIndexPaths: deleteItemsAtIndexPaths: or even reloadItemsAtIndexPaths: methods? Long…
4
votes
6 answers

UICollectionview scrollToItemAtIndexPath, not loading visible cells until animation complete

I have a UICollectionView with 142 Cells. 7.5 are visible at any one time. I'm moving a cell from indexPath 0 to say 100. But I also want to scroll to that new position. The code below works fine. But it animates the move and scroll, but then loads…
4
votes
3 answers

Error casting value of type 'UICollectionReusableView' to 'MyApp.CSSectionHeader'

I have the following class: class CSSectionHeader: UICollectionReusableView { @IBOutlet var textLabel: UILabel! } I'm then trying to cast it like the following: override func collectionView(collectionView: UICollectionView,…
gotnull
  • 26,454
  • 22
  • 137
  • 203
4
votes
0 answers

UICollectionView Horizontal Sticky Headers

I'm implementing a UICollectionView with a set of sections and I scroll the items horizontally. I was to accomplished this but I having a hard time adding a Section header on top of the items. I tried to add a Section Header accessory but it was…
4
votes
1 answer

UICollectionReusableView height based on UILabel text

I have a UICollectionReusableView which I would like to show in the header of my collectionView. I created a XIB file for the header and and dragged a UICollectionReusableView and laid out the elements inside that using auto layout. 2 of the labels…
4
votes
1 answer

Sizing supplementary views with auto layout in a custom UICollectionViewLayout

I am looking for the best way to use auto layout to calculate the size of supplementary views in a custom UICollectionViewLayout. For the purposes of clarity this is a simplified explanation of what I am trying to achieve. I have a header…
4
votes
1 answer

How can I test whether the UICollectionView header is currently in the view rect?

I need to know if the UICollectionView header supplementary view is currently in view in order to force it to refresh/update when an app setting/preference is changed. If the header is not in view, once scrolled to, the header will get drawn…
4
votes
1 answer

Error when adding Supplementary Header View to UICollectionView

I am getting the following error implementing the supplementary Header View Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no UICollectionViewLayoutAttributes instance for…
1 2
3
12 13