Questions tagged [uicollectionviewdelegate]

In iOS versions 6.0 and above, The UICollectionViewDelegate protocol defines optional methods that allow you to manage the selection and highlighting of items in a collection view and to perform actions on those items.

The UICollectionViewDelegate protocol defines methods that allow you to manage the selection and highlighting of items in a collection view and to perform actions on those items. The methods of this protocol are all optional.

Conforms to: UIScrollViewDelegate Framework: /System/Library/Frameworks/UIKit.framework Availability: Available in iOS 6.0 and later. Declared in: UICollectionView.h

Source: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewDelegate_protocol/Reference/Reference.html

100 questions
33
votes
6 answers

Change Background of UICollectionView Cell on Tap

I have a UICollectionView that I have created programmatically. I would like for the collection view to behave in the following way: 1. User touches cell 2. Cell background color changes 3. User releases touch 4. Cell background color changes This…
18
votes
4 answers

UICollectionView: How to define a UICollectionViewLayout that supports horizontally and vertically scrolling?

At the moment I'm trying to create an UICollectionView, that should display a simple excel-like-spreadsheet, with rows and columns. This should be an easy task with UICollectionViews, I believed. And I really would like to do the implementation in…
AxM
  • 612
  • 1
  • 7
  • 16
11
votes
1 answer

UICollectionViewLayout layoutAttributesForElementsInRect and layoutAttributesForItemAtIndexPath

I'm implementing a custom flow layout. It has 2 main methods for overriding to determine placement of cells: layoutAttributesForElementsInRect and layoutAttributesForItemAtIndexPath. In my code, layoutAttributesForElementsInRect is called, but…
8
votes
2 answers

UICollectionViewDelegateFlowLayout methods not called in Swift 2.3 App

None of my UICollectionViewDelegateFlowLayout methods are called. Can somebody help me find a solution? In my ViewDidLoad method, I have set delegate and datasource for collection view as self.collectionView.delegate = self and…
Y.R
  • 210
  • 2
  • 13
8
votes
2 answers

Strange disappearing items when scrolls

Presets, i have collectionViewFlowLayout subclass with - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { return YES; } - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { …
7
votes
1 answer

collectionView: didSelectItemAtIndexPath: does not get called

I have a UITableview. One of the UITableViewCell's is a UICollectionview with instance name "amenityView". The UICollectionViewDelegate and the UICollectionViewDataSource are set in the storyboard as shown below. The following methods get called…
6
votes
3 answers

Adjust insets of a specific section in UICollectionView

insetForSectionAtIndex (on DelegateFlowLayout) enables one to set insets for all cells within a section sectionInset (on FlowLayout) enables one to set insets that applies to all sections. However, I am looking for a way of applying insets to only…
6
votes
6 answers

Why is my UICollectionView cell not clickable in my swift ios app?

I'm using UICollectionView in my swift class, it's placed on my UIViewController. I connected the collectionView to the outlet in my code, I set up delegate and datasource and I see the outcome in my app. Everything works besides the fact that when…
6
votes
1 answer

UICollectionView show footer only for the last section

How can I show footer view only for one section? As I found out, I can't pass nil to hide footer views in other sections, as it produces crash. override func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind:…
Shmidt
  • 15,652
  • 16
  • 79
  • 129
4
votes
2 answers

Animate changes in UICollectionViewFlowLayout

I'm using a UICollectionViewFlowLayout to arrange view tiles in a horizontally scrolling view. By default, I make them square using the UICollectionViewDelegateFlowLayout: func collectionView(_ collectionView: UICollectionView, layout…
4
votes
2 answers

Using UICollectionView with CoreData and NSFetchedResultsController

I recently started another project exploring Swift a little bit. I want to implement a Collection View using a NSFetchedResultsController to get the data out of my CoreData database. I wanted to use the example from…
4
votes
2 answers

UIViewController calls sizeForItemAtIndexPath for all cells on load

I have a UICollectionView with UICollectionViewFlowLayout. While testing with large data (5,000+ cells) I noticed a lag when loading. I found out that at loading the sizeForItemAtIndexPath is called for EVERY cell. Since I am doing a messaging like…
4
votes
1 answer

UICollectionViewCell becomes hidden=YES

I am trying to implement an "endless scroll" with UICollectionView. I do this by buffering my data array like in this tutorial and then by implementing the didEndDisplayingCell of UICollectionViewDelegate in the following manner: -…
4
votes
1 answer

Difference between UICollectionViewDelegateFlowLayout UICollectionViewFlowLayout

I know that UICollectionViewDelegateFlowLayout is a protocol while UICollectionViewFlowLayout is a class, and I know the difference between a protocol and a class. From my understanding, I can have a class to follow the…
3
votes
0 answers

Wait for tap to end on UICollectionViewCell before setting isSelected to true

Currently, I have a collectionView and its only function is to let the user choose a color. When the user chooses a color (clicks a cell), a selected indicator (UIView) animates inside the cell, letting the user know that that certain color is…
gmdev
  • 1,992
  • 2
  • 7
  • 19
1
2 3 4 5 6 7