4,460 questions
0
votes
0
answers
69
views
How to reduce cell height (vertical margins) when using UIListContentConfiguration
The default cell height is 44pt in iOS 18 and 52pt in iOS 26. I'm trying to reduce the height back to 44pt in one screen that needs to fit as much content on screen as possible. How do you reduce the ...
0
votes
1
answer
80
views
Why are my UICollectionViews all showing the same cell data (the last array entry)?
I use 2 custom classes that inherit UICollectionView. Both are showing a similar bug of all the items in the collection view are showing the last item in the source array.
For example this code ...
-1
votes
1
answer
186
views
Do I need a UICollectionView.CellRegistration for every individual (content)configuration type?
I am a bit struggling with the concepts of UICollectionView.CellRegistration and dequeueConfiguredReusableCell and reusing them. It seems I cannot find the answer on this site either. Sorry if this is ...
1
vote
1
answer
498
views
How to run tasks off the main actor with Swift Concurrency
I am using a Task block to fetch images from disk to be displayed in a UIImageView.
I noticed that as I scroll the collection view, there's noticeable lag caused by the getArtwork method meaning it is ...
1
vote
0
answers
160
views
How to make a simple collectionView on a storyboard display data from a diffable datasource
I'm trying to do something very similar to How to make a simple collection view with Swift (with a storyboard), the only difference being that I want to use a diffable datasource, whereas in the ...
0
votes
0
answers
32
views
CollectionViewCell updating wrong after scrolling
I have a collection view that lists a number of items that initially are not selected. If the user taps on them, a border appears around the element and the id for that element is added to an array. ...
0
votes
1
answer
150
views
Manually call updateConfiguration swift
I have a simple cell which contains text and switchView
final class MFTestLabel: SUCollectionCell {
// MARK: - Properties
weak var delegate: MFTestLabelDelegate?
private let ...
0
votes
1
answer
41
views
UICollectionviewCell when scroll horizonatlly to next page only half cell is display
I am using UICollectionView, where It should works like carousel.I want to display some part of previous cell - current cell - some part of next cell. I have played around with item size and ...
0
votes
0
answers
43
views
UICollectionView Padding/EdgeInsets for views in children
I have a UICollectionView which uses a UICollectionViewFlowLayout to layout its children. These children will have varying heights, so I need to adjust the UICollectionView such that the elements are ...
1
vote
0
answers
223
views
Dynamic width horizontal Collection view using compositional layout
I am trying to create a collection view that has a simple cell with text, which means that the width and height of the cells should be dynamic. Since it should be able to be shorter/longer and the ...
0
votes
1
answer
44
views
Using UICollectionViewCell with IBOutlet
I wonder if it is possible to use UICollectionViewCell with IBOutlet? As I always get this error
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the cell ...
1
vote
1
answer
81
views
How can I create horizontal collection view with auto height in swift?
I created a horizontal collection view that calculates its own height, but the height is not calculated as desired.
My flowlayout and height constraint codes are as follows:
if let flowLayout = ...
0
votes
2
answers
79
views
How to set correct tintColor with selected but not focused UICellAccessory.customView
In a UICollectionView within a UISplitViewController layout, I have a UICollectionView.CellRegistration that shows under certain conditions a warning badge as UICellAccessory.
This warning badge ...
0
votes
1
answer
200
views
How to calculate the cell size?
How to calculate the cell size so that different devices display the same number of cells in row and column, and the cell height is adjusted to the screen size of the device?
I tried calculating it ...
0
votes
1
answer
50
views
Unable to give required width, and height for collectionview cell in swift
I have gicen collectionview height as 300 and added cell with imageview and label
for label given constraints bottom, leading, trailing = 10 and for image given top, leading, trailing = 10, bottom = ...
0
votes
1
answer
165
views
Making a certain view tappable in CollectionView cell
I want to make certain view in cell of collectionView tappable.
Code Of ViewController
class ViewController: UIViewController {
let collectionView:UICollectionView = {
let view = ...
0
votes
1
answer
21
views
Can't CollectionViewCell Dynamic Label Width in TableViewCell
I placed a CollectionView inside a TableViewCell. I added a Label inside the CollectionViewCell and set up all the constraints using Xib. However, the CollectionView still relies on the width and ...
0
votes
1
answer
96
views
UILabel not drawing text properly in UICollectionViewCell
I have a UILabel that sits inside a UICollectionViewCell. The UILabel is multiple lines and may be different sizes based off of the text supplied. The cell sits in a collectionview with a simple ...
-1
votes
1
answer
80
views
prevent cell stacking in UIcollectionView
I've been working on a collection game using apple maps in Objective C. Each item you collect appears in a uicollectionview. it works perfectly fine until you get around 15 or so and have to start ...
0
votes
2
answers
1k
views
UICollectionViewCompositionalLayout Collectionview cell width not resizing properly after reloading data
I Am using UICollectionViewCompositionalLayout to create dynamic width, fixed height, tag cell type of layout in some sections of my collectionview. When i add a new string to an array in my database, ...
1
vote
1
answer
36
views
Center a UIView without affecting the position of other UI classes in UIKit programmatically
I want to move the position of a UIView boardGame: UICollectionView to be on the center of the screen by modifying the constraints properties such as topAnchor, but anything I do to it seems to affect ...
0
votes
1
answer
205
views
Multiple calls to scrollToItem(at:at:animated:) in quick succession causes scrolling glitch in UICollectionView
In my setup I have a horizontal collection view with chip style, on initial load the first chip is selected by default and corresponding to the chip an API call is made and it's data is loaded into a ...
1
vote
2
answers
1k
views
.NET Maui CollectionView, how to display value only if value exists
I would like to display the properties in a list of objects, but if the properties don't have any values I'd like to not only leave it blank but have the entire row not there at all (that's key).
Here'...
0
votes
1
answer
47
views
All CollectionViewCell height equal to largest cell label dynamic content in swift
All CollectionViewCell height equal to largest cell label dynamic content full code in swif
import UIKit
class YourViewController: UIViewController, UICollectionViewDataSource, ...
0
votes
1
answer
75
views
How do we know the specific item in cellForRow method when compositional layout is used
I have created a collection view with compositional layout, Below is the code I have used for creating the layout.
func getCompositionalLayout() -> UICollectionViewCompositionalLayout {
...
0
votes
1
answer
226
views
UICollectionView Cells not updating when associated data is updated
I have a collectionview, and each cell has an 'empty star' button. When the user taps on that button, the image of the button should become a 'filled star.' The collectionview should sort itself so ...
0
votes
2
answers
41
views
Unable to change collectionview cell background colour in Swift
I have given constraints for image and label like this
Image constraints. Label Constraints
code: with this code i am able to get selectedNamesArray but unable to change cell colour. where am i wrong? ...
-1
votes
2
answers
437
views
Collectionview Card Layout
Here is a screenshot of what I want to achieve:
I need this type of collection view layout for card cells (with leading and trailing edging displays).
import UIKit
class ViewController: ...
0
votes
2
answers
132
views
How to set custom UICollectionView Cell Size
Hi Community I wanted to implement a UICollectionviewCell which have size of 110 and each row have 3 cells initially
1.) Now need to do some modification in such way firstRow should have 3 cells but ...
0
votes
1
answer
23
views
How to reach UICollectionViewCell on ViewController
I have a collectionViewCell with 2 imageView in it. I create 8 from this Cell. I have a function called Flip which allows me to change the imageView. What I want to do is that when the game starts, ...
0
votes
1
answer
62
views
Collectionview cells are not showing according to screen width
cells are not showing in particular order i need 3 cells in a row so tried CGSize(width: UIScreen.main.bounds.width * 0.3, height: 100) but getting unrelated out put
code:
class ViewController1: ...
0
votes
1
answer
60
views
UIImage Sizing in Dynamic Collection View Cell with Autolayout and UICollectionViewCompositionalLayout
Context: I have a collection view with dynamic cell height defined by its cell's content. The cell's content: a UIView, a UILabel, and a UIImage (image and label vertically positioned).
Problem: ...
1
vote
0
answers
49
views
Right way to implement a collectionView where each cell has a remove button
To make a collectionView where each cell has a delete button, I can think of two ways:
Create a custom cell that has the delete button.
Cons: We have to create a custom cell from an existing cell ...
0
votes
1
answer
40
views
Ten extra UITableViewCellContentViews appear blank and stacked on top of each other in the TableView. Sometimes it happens, sometimes it doesn't
Ten extra UITableViewCellContentViews appear blank and stacked on top of each other in the TableView. Sometimes it happens, sometimes it doesn't. You mentioned that you have defined cells above and ...
0
votes
1
answer
207
views
Collection View[Error] Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value [duplicate]
I am creating collection-view with screen transition and then An error which is "Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value". I have attached ...
2
votes
1
answer
82
views
TableView frequent reload stops user interaction of button inside cell
Working on one screen where there is UITableView and reusable UITableViewCell with UIButton actions
UITableView is having high (twice in ms) reload frequency because of reloading frequently, the cell ...
2
votes
1
answer
2k
views
Infinite horizontal collectionView with first cell able to scroll left
I created an infinite horizontal collectionView presenting the first 6 items of my database, something like carousel. So, when I am scrolling to the right side, I can see those 6 items with the order ...
0
votes
1
answer
92
views
How to animate a collapsable tableview in a CollectionViewCell in swift?
I am trying to make my tableView that is nested in a CollectionViewCell animate when it collapses and expands like in the FotMob app: FotMob example
When I try this it just either don't animate or ...
0
votes
1
answer
209
views
UICollectionView didSelectItemAt not working
I need an animation when a collection view cell is tapped. I wrote an override function for it. But UICollectionView didSelectItemAt is not working when I override touchesBegan on the custom cell.
...
1
vote
1
answer
67
views
CollectionViewCells do not display any data
I've used CollectionViews in my project in another area of my project successfully with no issues, but this one simply won't display the data in the cell no matter what I do. I can see the cell ...
1
vote
0
answers
66
views
Asynchronous Data Loading Not Updating UI in UICollectionView
I'm developing a messaging app that fetches messages and their associated media from a server. I'm using a UICollectionView to display these messages, initially showing a placeholder until the actual ...
1
vote
2
answers
370
views
How to align CollectionView cells to the left with equal spacing and dynamic widths in Swift iOS?
Aligning CollectionView Cells to Left with equal spacing in between (Cells will be of dynamic width depending on the data received i.e the length of the string that will go in the cell).
My Custom ...
0
votes
1
answer
63
views
How to fix UICollectionViewCells sometimes not loading in?
I am trying to make a little horizontal UICollectionView in the top section of my app but every time I load the app there are always like 2 or 3 cells that don't load its content. And the cells that ...
0
votes
1
answer
152
views
UICollectionViewCompositionalLayout Tag Layout with Dynamic Cell Height
I am trying to achieve this kind of tag layout (collectionview cells with dynamic width and height) but code crashes with some constraint errors when the text for a label within a cell is very long. ...
1
vote
1
answer
777
views
Collection View cells to fit exactly 3 per row in all devices swift
I am trying to make a collection view of images, so that there are 3 per row, with some spacing in between.
Code:-
func setupCollectioView(){
guard let collectionView = gridPhotosCollectionview, ...
0
votes
2
answers
1k
views
Swift 5, Kingfisher - How to guarantee no duplicate images when loading images to Collection view cell?
I am currently using Kingfisher library to load thumbnail images for collectionview cells and if it is already recorded in the cache, it would load from the cache. Seldomly some images are loaded for ...
0
votes
1
answer
99
views
UITableview cell overlap on scroll
Some odd behaviour.
Got a UITableview with dynamic custom cell.
As part of the custom cell is a UIStackView which contains a dynamic number of buttons.
These display as expected. See image 1
However, ...
0
votes
0
answers
193
views
How to change the height of the banner to fit an image iOS UIKit
I have a banner view that shows 3 images. The image is currently cropped so that it would fit in the bannerView. I tried changing the content mpde of the imageView, but none of it works. I tried ...
-1
votes
1
answer
78
views
UIKit - UICollectionView - presents only half of the last cell
I have a horizontal UICollectionView with custom UICollectionViewCell with UILabel
-which I've built with the interface builder storyboard + xib file for the cell)
I want to have some space between ...
0
votes
1
answer
324
views
How to resize the first UICollectionView cell on scroll / Swift 5
I have a vertical UICollectionView and when I scroll I want the first cell to be slightly larger than the others.
This code partially solves my problem...
However, when I scroll to the end of the list,...