Questions tagged [uicollectionviewflowlayout]

209 questions
0
votes
0 answers

UICollectionView paging via cell width

I want to make paging in collection view not by collection view width, but by collection view cell width. As shown in image. After paging in collection view, I want to align current cell at the left side of screen and keep left side of next cell…
0
votes
1 answer

How to make square cells with collection view layout in swift

I'm programming a game with a collection view with 121 buttons (11X11), how can I fix my Collection View cells to be a square? I want to increase or decrease the number of cells so the layout has to be dynamic This is the code: import UIKit class…
0
votes
1 answer

How to show grid lines in Collecionview Swift

I am doing Swift application with custom collectionview. I would like to show columns rows in that and I have achieved it. But, I would like to show grid lines inside the cells. Below is my code: Viewcontroller class import UIKit private let…
0
votes
0 answers

Will a UICollectionViewCell be reused if the collection view is within a UIScrollView?

I appreciate that the answer to the title of this post may be "depends", but let me add some further info. I am creating an app which contains a view similar to the profile page of Instagram. I have been struggling to come up with a way to best do…
0
votes
0 answers

how to detect UICollectionView update or reload in customize UICollectionViewFlowLayout?

my customize UICollectionViewFlowLayout like this: override func prepare() { super.prepare() // compute all cell frame } prepare() will be called after any data changed(reload, insert, delete) and all cell frame will be recomputed. so how…
JoShin
  • 71
  • 3
  • 10
0
votes
0 answers

using UiCollectionView I don't want too large central space on iPhone 11

the issue: only on iPhone 11, I have two columns of cells, with very big space in the center, on other devices I have 3 cells on 2 columns, I'd like same result on iPhone 11 too at this moment my solution is minimumInteritemSpacingForSectionAt from…
biggreentree
  • 1,633
  • 3
  • 20
  • 35
0
votes
1 answer

UICollectionView consuming vertical pan gesture

I have a UICollectionView that is inside a UITableView and that is inside a UIScrollView. The collection view is a horizontally scrolling carousel of items and this works fine if there are enough items in the collection view so that it is wider than…
0
votes
1 answer

Adjust UICollectionView UICollectionReusableView (header) width

I would like to adjust collectionview header width in iPad. public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) ->…
kb920
  • 3,039
  • 2
  • 33
  • 44
0
votes
1 answer

Swift: UICollectionView sizeForItemAt will never be executed

I'm making a CollectionView which has 2 sections, everything is fine but the size. I'd like to give different size of cell in different section, but when I call sizeForItemAt, Xcode shows a yellow warning "Will never be executed". Here's how I set…
0
votes
2 answers

Left aligning UICollectionView Cells without using Custom Layout

I'm trying to create a left aligned collection view. The most poplar way of achieving this seems to be by using Custom Collection view layouts (ex: https://stackoverflow.com/a/36016798/11515703). However, I'm trying to do this without using Custom…
0
votes
1 answer

Understanding UICollectionViewFlowLayout sizing and spacing

I am working with a UICollectionView using UICollectionViewFlowLayout and have some difficulties to understand item sizing an spacing. I know that there several methods to adapt sizing and spacing (using the delegate methods, overriding FlowLayout,…
0
votes
0 answers

Reload CollectionView Cell with custom UICollectionViewFlowLayout

I have a custom UICollectionViewFlowLayout which lays out items with a left-aligned format. LAYOUT override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { var newAttributesArray =…
David Henry
  • 1,972
  • 20
  • 43
0
votes
1 answer

UICollectionViewFlowLayout for self-sizing, full-width items: incorrect y position

I am trying to implement a collection view, in which items have: automatic height based on constraints the full available width of the collection view. I'm aware that this is pretty easy to accomplish UICollectionViewCompositionalLayout, but I'm…
0
votes
2 answers

How to move selected row to the top of UICollectionView

I have a UICollectionView of UICollectionView, so each row has 1 cell with a UICollectionView inside. I want that the selected row always move to the top of the my CollectionView, currently the selected row is centered inside the…
0
votes
1 answer

Alignment and Two Line Horizontal scrollable in UICollectionView Swift

I am new here, actually I haven't found an answer that how to setup two line horizontal collectionView Items. I have already created tag items CollectionView and as a one row it works perfectly fine. But I want to divide it into two rows but it also…