Questions tagged [uicollectionviewlayout]

The UICollectionViewLayout class is an abstract base class that is used to generate layout information for a collection view.

The UICollectionViewLayout class is an abstract base class that you subclass and use to generate layout information for a collection view. The job of a layout object is to determine the placement of cells, supplementary views, and decoration views inside the collection view’s bounds and to report that information to the collection view when asked. The collection view then applies the provided layout information to the corresponding views so that they can be presented onscreen.

More: UICollectionViewLayout Class Reference

1496 questions
-1
votes
1 answer

How to avoid/disable vertical scrolling for Collection View in iOS

I have a collection view that is customized to show multiple column data. I am using a custom Collection view flow layout class to layout the cells of the column. The code is working fine, but during vertical scrolling, the layout of cells gets…
lazymind
  • 74
  • 1
  • 2
-1
votes
1 answer

How to create a UICollectionView Programatically

Image here Hey I'm pretty new to swift and I'm trying to make multiple collection views, so far I think I've got it correct but I'm not sure what to return on these two errors, can anyone help? I think for the top on I just need to return the…
-1
votes
1 answer

Swift UICollectionView with Horizontal Scrolling and Layout Each Section Left to Right on Own Row

I would like to have UICollectionView with Horizontal Scrolling and Layout each section on it's own row from left to right. Currently my CollectionView with Horizontal Scrolling has a vertical layout for each section. Ideally I would like the…
Ranknoodle
  • 847
  • 12
  • 28
-1
votes
2 answers

Is there a way to add padding to a UICollectionView cell programmatically?

I would like to know how to add padding to cells within a collection view. In the image above, you can see that the shadow of the cell is being cut off where the table view ends(see black arrow). I am fairly new to Swift programming, so a thorough…
-1
votes
1 answer

Animate UICollectionView contentInset adjustment

Is there any way to animate the invalidateLayout() call on a UICollectionView layout? I have a collectionView with a custom layout, and a view that is animating on top of that collectionView. I would like to animate the repositioning of the cells…
Plastech
  • 757
  • 6
  • 17
-1
votes
2 answers

Place the collection view cells vertically instead of horizontally?

How to design UICollectionView in such a way that it fills the collection view cells vertically (column-wise) instead of filling horizontally (row-wise)? The collection view should be vertically scrollable, I should not change the size of the…
-1
votes
2 answers

I'm trying to achieve this UICollectionView layout

This is what i have achieved till now in my UICollectionView This is my UICollectionViewDelegate function func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath:…
-1
votes
1 answer

How to display only one cell of the collection view on the screen anytime in objective-c

I have a collectionview with custom collectionviewcell. I want to make a gallery that only one image display on the screen at any time. What i have to do ? Here is my code : [myCollectionView registerClass:[myCustomCollectionViewCell class]…
-1
votes
4 answers

When UICollectionViewLayer is set, cellForItemAt doesn't called

I want to set UICollectionViewLayout for my UICollectionView but when the layer is set, the function cellForItemAt doesn't called. I don't understand why. My UICollectionView is in a XIB, with this code for testing the UICollectionViewLayout…
-1
votes
1 answer

How to make sticky headers with collection view layout (not flow layout) and UICollectionViewLayoutInvalidationContext?

I want to implement sticky headers in my collection view layout, but in a efficient way. I looked into the apple documentation and I found UICollectionViewLayoutInvalidationContext. I implemented this object along with my custom collection view…
CarlosAndres
  • 585
  • 1
  • 5
  • 14
-1
votes
1 answer

ambiguous reference to member 'subscript' swift 3

I am trying to create a UICollectionViewFlowLayout subclass and i am getting ambiguous reference to member 'subscript' error when i try to return the layoutAttributesForItem: import UIKit class FLCollectionViewFlowLayout:…
cromanelli
  • 576
  • 1
  • 5
  • 21
-1
votes
1 answer

Custom UICollectionViewLayout and constraints

I have a custom flow layout. I know where my cells need to be. I currently create specific frames for each cell. However, I'm worried about different sized iPhones so I want to explore creating constraints. I know this has to be done in the function…
jDoe
  • 61
  • 1
  • 5
-1
votes
2 answers

UICollectionView: What is the difference between contentSize and bounds?

What is the difference between: self.collectionView.contentSize.height and self.collectionView.bounds.origin.y? The latter always seems to be smaller than the former? Any clarifying sketches would be highly appreciated.
-1
votes
1 answer

iOS Collectionviewcell multiple items and dynamic height

I have a UICollectionView cell, which has multiple items I need to implement its dynamic height depending on the data of 1st bold label I have tried multiple code snippets but not working for my case. as most of them are checking a specific label…
Majid Bashir
  • 558
  • 1
  • 4
  • 27
-1
votes
1 answer

UICollectionView: change the layout on the fly?

I have a requirement to create a view controller that behaves a lot like a webpage; if the user presses the button, the layout changes on-the-fly, and the press another button and it goes back to divisional layout. the first layout is like a table…
1 2 3
99
100