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
8
votes
2 answers

UICollectionView Header xib not showing

I have a collectionview and I want to use a xib as the header. However, the xib will not appear. First I tried adding a label to the xib, which didn't appear. Then I set the whole background color to red. It it doesn't appear. The collectionview…
Jameson
  • 4,198
  • 4
  • 17
  • 31
8
votes
4 answers

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

I am implementing an infinite-scrolling calendar. My issue is that I would like to set the current month as the title in the navigation bar and it should update while scrolling - once you pass the section header view the title should update in the…
8
votes
1 answer

iOS 7 - UICollectionElementKindSectionHeader crashes app ('UICollectionView dataSource is not set')

Trying to add a section header to my uicollectionview. When I don't use a section header, collection view loads fine, no problems at all. When I try to use one, I get this error: *** Terminating app due to uncaught exception…
JimmyJammed
  • 9,598
  • 19
  • 79
  • 146
8
votes
3 answers

How to create a 'sticky' footer for a UICollectionView?

What is the best method to provide a footer for a UICollectionView that "sticks" to the bottom of the screen bounds on a given page? Assume the UICollectionView is full screen and only has one section. Currently I am providing a…
toblerpwn
  • 5,415
  • 8
  • 38
  • 46
7
votes
1 answer

CollectionViewLayout Supplementary View height equal to content

I have a UICollectionViewLayout subclass with in it a Supplementary View that contains a multi-line UILabel. The problem is that not all the text is visible at a certain point, how can I give the Supplementary View the height equal to its content?
6
votes
1 answer

Need Header on Top for Horizontal UICollectionView UIKIT

I am implementing custom headers for UICollectionView I need a header on the Top for Horizontal CollectionView.
6
votes
0 answers

How can I add additional supplementary views to UICollectionViewFlowLayout with Swift?

As described in the Collection View Programming Guide for iOS, if you want to add new supplementary or decoration views to your Flow Layout, you have to subclass UICollectionViewFlowLayout. I need help to implement the following steps in Swift…
6
votes
2 answers

How to Reload UICollectionView Supplementary View (HeaderView)

First things first: I do NOT Want to reload whole CollectionView. I also do NOT want to reload the section either (since it is same as reloadData because my cv only has 1 section). I put some controls in the Supplementary View since this view…
GeneCode
  • 7,545
  • 8
  • 50
  • 85
6
votes
2 answers

Auto-sizing UICollectionView headers

I'm trying to make a detail screen for a to-do list kind of app. Here's what the detail screen currently looks like: This is a UICollectionViewController, with a header. The header contains 2 UILabel objects, and a UITextView object. The layout of…
Kelvin Lau
  • 6,373
  • 6
  • 34
  • 57
6
votes
1 answer

preferredLayoutAttributesFittingAttributes not called for supplementary views

I have a custom UICollectionViewLayout that makes use of the self-sizing mechanism in iOS 8. My UICollectionViewCell's implement preferredLayoutAttributesFittingAttributes to return their preferred size, calculated using auto-layout. This works…
6
votes
0 answers

Automatic height of UICollectionView header according to contents

I've put a header (UICollectionReusableView) in the collectionView my storyboard. Inside this header is a UILabel. How would I automatically adjust the height according to the contents of the label?
cannyboy
  • 24,180
  • 40
  • 146
  • 252
5
votes
0 answers

UICollectionReusableView Height can't resize when one of its UITextViews grows by more than one line

I am using a UICompositionalLayout to set the layout of my collection view. For the header of each section I am using a UICollectionReusableView, which contains three buttons at the top and two textviews below them. The UI is set up in the following…
5
votes
3 answers

UICollectionView sticky header disappears for while after inserting section when collection is overscrolled (bounce effect)

I'm using UICollectionReusableView as a header of UICollectionView section. I enabled "sticky headers" with: let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout layout?.sectionHeadersPinToVisibleBounds = true I'm…
5
votes
0 answers

no UICollectionViewLayoutAttributes instance for -layoutAttributesForDecorationViewOfKind

I'm using a custom layout to get several background color sections using UICollectionReusableView's subclasses. This is the code: - (void)prepareLayout { [super prepareLayout]; self.itemAttributes = [NSMutableArray new]; NSInteger…
5
votes
2 answers

Difference between dequeueReusableCellWithReuseIdentifier: and cellForItemAtIndexPath:

I have been wondering why my code works well with cellForItemAtIndexPath: & not with dequeueReusableCellWithReuseIdentifier: while fetching collection view cells. Here is my code: This one works Fine: NSInteger numberOfCells = [self.collectionView…
1
2
3
12 13