Questions tagged [uicollectionviewcell]

UICollectionViewCell is a class from UIKit framework in iOS. A UICollectionViewCell object presents the content for a single data item when that item is within the collection view’s visible bounds. Available in iOS 6.0 and later which is inherited from `NSObject->UIResponder->UIView->UICollectionReusableView->UICollectionViewCell`

Cells present the main content of a collection view. The job of a cell is to present the content for a single item from the data source object. Each cell must be an instance of the UICollectionViewCell class, which you may subclass as needed to present your content. Cell objects provide inherent support for managing their own selection and highlight state, although some custom code must be written to actually apply a highlight to a cell. A UICollectionViewCell object is a specific type of reusable view that might be used for main data items.

To configure the appearance of your cell, add the views needed to present the data item’s content as subviews to the view in the contentView property.

Resource

Questions

4470 questions
1
vote
1 answer

issues with cellForItemAt indexPath cell downloading data

I have a UIColelctionView cell that should contain users names located in a firebase database. First I referenced the custom cell using: let f = FriendCell() In cellForItemAt indexPath, I define each cell and reference the array from which the data…
Stefan
  • 908
  • 1
  • 11
  • 33
1
vote
2 answers

Swift UICollectionView - Add/remove data from another class

I have a main view controller executed first which looks something like below, MainViewController class MainViewController: UIViewController { var collectionView: UICollectionView! var dataSource: DataSource! SomeAction().call() { …
moustacheman
  • 1,424
  • 4
  • 21
  • 47
1
vote
1 answer

UICollection View inside Table Cell does not show images in Swift 3

I put UICollectionView inside table cell in Home page. Each category row has their contents image. But, my problem is that when I run the app, the images under second row/second category do not show whenever I run the app. The images will show…
1
vote
0 answers

UICollectionView space between cells

In my case I want completely remove any spaces between UICollectionViewCell's. In iPhone 5 it works correct but iPhone 6 and up. Every time I scroll or in the initial load UICollectionView adds empty space for different rows. I know that could be…
1
vote
0 answers

UICollectionView showing same image on multiple cells

I am facing a very strange problem. My UICollectionView is rendering the same image for multiple cells. I am loading images from external sources. Here is my code. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath:…
TechBee
  • 1,897
  • 4
  • 22
  • 46
1
vote
2 answers

Shrink hight of collectionViewCell if no image

I have a cell with image pinned to left-top-right of cell. Other constraints related to image. Here is image height constraint: Here is my data setter: import UIKit import Kingfisher class WorkoutSectionCollectionViewCell: UICollectionViewCell…
andrey
  • 1,136
  • 9
  • 19
1
vote
1 answer

Swift iOS -How to Truncate Horizontal CollectionView Cells when they are about to go past Screen Bounds

I have a collectionView cell that displays the cells horizontally. I only want a set number of cells to show on the screen and after the amount I want to display ... or something to signify there are more cells available. I don't want the user to…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
1
vote
1 answer

Swift: Load cell in correct section of UICollectionView?

I am loading two objects of the same type into two separate arrays. The first array is of type [Post], along with the second array. I have two sections in my collectionView and I want to load the first array into the first section and the second…
Daniel Dramond
  • 1,538
  • 2
  • 15
  • 26
1
vote
2 answers

show viewController from collectionView without storyboards

I am having some trouble showing a viewController programmatically (without storyboards) from a collectionView. I would think this is pretty easy but I am having some difficulty figuring this out as I am somewhat new to swift. I believe…
user3708224
  • 1,229
  • 4
  • 19
  • 37
1
vote
1 answer

iOS Swift 3 - UIButton on UIStackView in UICollectionViewCell is not responding to tap events (no interaction)

I have a UICollectionViewCell subclass which has a UIStackView on it. The StackView is populated with UIButtons and everything looks fine however the buttons are untappable. If I layout the same buttons on a UIScrollView (for the sake of…
Zigglzworth
  • 6,645
  • 9
  • 68
  • 107
1
vote
3 answers

UIImageView layer border issue

I have a UIImageView and set it's layer's borderColor, borderWidth, and cornerRadius like imageView.layer.cornerRadius = imageView.bounds.height/2.0 imageView.layer.borderWidth = 6 imageView.layer.borderColor =…
Nazariy Vlizlo
  • 778
  • 7
  • 16
1
vote
1 answer

Yet another "could not dequeue a view of kind: UICollectionElementKindCell with identifier song"

I'm getting the classic message "could not dequeue a view of kind: UICollectionElementKindCell with identifier song". I can't tell why. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a…
Hack Saw
  • 2,741
  • 1
  • 18
  • 33
1
vote
3 answers

How to implement different collection view cell types in a single collection View?

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let dev = devices[indexPath.item] if dev.cuid == "3011"{ let cell =…
1
vote
1 answer

Set the size of a collectionView with cell of different width, in a horizontal scrolling

I'm trying to set a UICollectionView as a horizontal menu, on top of another UICollectionView (but that's irrelevant). Now my cells are basically composed of label, which are as you can imagine of different width. So I tried to calculate the size…
petaire
  • 495
  • 1
  • 10
  • 23
1
vote
1 answer

passing an AVPlayerLayer reference up heirarchy

I have an AVPlayer located in a collectionView cell, that's in a collectionView, that is located in a collectionView cell. So to recap, each one of my cells has a collection view in them. Inside that collection view are three cells. One of which…
Stefan
  • 908
  • 1
  • 11
  • 33