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
4
votes
1 answer

UICollectionView Header Compatible Views

I've constructed an UICollectionView in a storyboard and implemented all of its required data source and delegate methods in the view controller. In the storyboard, I checked the Section Header property on the collection view and set the header…
The Kraken
  • 3,158
  • 5
  • 30
  • 67
3
votes
2 answers

Flickering issue with UICollectionView while reloading

I'm developing an application where the user clicks on a menu item and the tableView should scroll according to the selected item. But the problem is collectionView flicks a little bit while reloading. Here I'm getting the visible section. func…
3
votes
2 answers

How to use custom UICollectionReusableView as section header of collection view?

I've been driven insane for hours as I can't get around with the issue. I have a collection view which can have different section with different no. of items in each. For each section I need to use a section header of different type. So for this,…
nayem
  • 7,285
  • 1
  • 33
  • 51
3
votes
3 answers

How to dynamically add labels and buttons in section header of UICollectionView?

Please help me how I can add labels horizontally and similarly buttons horizontally but each button should align at down of each label like a another section. This should happen dynamically in the header of the UICollectionView as the number of…
3
votes
3 answers

UICollectionViewCells deque returns wrong cell

I have a CollectionView, I use the cells to display videos and I also store some other data on variables. And whenever I scroll I reuse previous cells using the following code: let cell =…
3
votes
1 answer

Popover segue from UICollectionView ReusableView (header)

I added a UIButton to a UICollectionView header. I like to instigate a popover segue from the button to a UITableViewController. I control-drag from the button on the collection view header to the tableView Controller and choose present as popover…
3
votes
2 answers

edit frame height Collection reusable View

using Xcode 7.0 beta, Swift 2.0, IOS 9 supported I have a View Controller, which contains a Collection View. Inside is a header: Collection Reusable View, a collection: Collection View Cell and a footer: Collection Reusable View. Inside the header,…
CularBytes
  • 9,924
  • 8
  • 76
  • 101
3
votes
1 answer

IOS - Sticky UICollectionView Header (like Apple App Store)

I am trying to create a header like the one in the App Store. Where when the user drags down, the header stays in place and only the cells scroll down. But when the user drags up, both the header and cells scroll up. What I have done so far is set…
3
votes
2 answers

Update text in section header (UICollectionReusableView)

How can I update UICollectionView section title? Headers (titles) for sections in my collection view show the total number of items available on each section and I need to update that title when the user has deleted items from the collection. I'm…
Aнгел
  • 1,361
  • 3
  • 17
  • 32
3
votes
2 answers

UICollectionView header width

In my UICollectionViewFlowLayout subclass I have this: self.headerReferenceSize = CGSizeMake(280, 44); However the header is displayed with a width of 320, which is the width of the collection view. This is correct according to the docs: During…
soleil
  • 12,133
  • 33
  • 112
  • 183
3
votes
1 answer

Cannot get UICollectionView header to work

Here's relevant code: Controller: - (instancetype)init { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.itemSize = CGSizeMake(106.0, 106.0); layout.minimumInteritemSpacing = 1.0; …
user908015
3
votes
1 answer

How can I add a title/label supplementary view for each cell in a UICollectionViewFlowLayout?

All examples I've seen use the supplementary view as headers or footers. I need to add a label above and/or below each cell in my flow layout. At first I thought all I had to do was register a class for a supplementary view of kind and then…
2
votes
1 answer

UICollectionView doesn't show footer when using a custom flow layout

I have a UICollectionView, with header and footer enabled: The height for the footer is set here: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section:…
2
votes
1 answer

Collection view with Compositional Layout not working for header view

Trying to create UICollectionView using compositionalLayout. It's working for collection view cell but when I am trying to add header it crashes with register nib error: Terminating app due to uncaught exception 'NSInternalInconsistencyException',…
2
votes
1 answer

Reload data not working in HeaderView in Swift

I am not able to update the data of the Header View of a CollectionView. This header view is a subclass of UICollectionReusableView. I tried to call a method for reloading this data in different places but none of them is triggering the update. To…
Maruta
  • 1,063
  • 11
  • 24