Questions tagged uicollectionview

Explore the latest questions and answers asked by our top developers.

MessageKit Collection View doesn’t display any cells after adding support for a custom cell`

I’ve read through the guide for creating a custom cell in MessageKit here, and SO questions like this I’m trying to create a custom cell; here’s my code for a cell that inherits from a UICollectionViewCell: import UIKit import MessageKit open class ChatReferenceCell: UICollectionViewCell { @IBOutlet weak var authorLabel: UILabel! @IBOutlet weak var referenceText: UITextView! […]

Self Sizing CollectionView cell not work properly after reload data

I am creating a collectionView that can have multiple sections with a self-sizing cell. it works nicely on the initial layout. but after reload, I encounter three problem Scrolling become choppy cell size changed and cell overlap with each other content offset changed after reload data here is ViewController code class ViewController: UIViewController { @IBOutlet […]

collectionview global header does not push cells down and stays on top instead

I have a collection view header (blue) and cells (red). I want to be able to show/hide header programmatically, however when I show the header programatically it appears on top of the cell (or makes scrollview go down a bit). I would like the header to push the whole scrollview down, so I wouldn’t have […]

Getting Error "No Ad To Show" When Implementing AdMob into Swift App

I am trying to do the (seemingly) simple task of integrating Native AdMob ads into my iOS app running on Swift. Let me first show you my storyboards and code for integration and then we’ll move on to things I’ve tried to fix it. Set-Up: Storyboards and Code In my App Delegate, I configure Firebase […]

By Jacob Cavin
Published
Categorised as admob, firebase, swift, uicollectionview Tagged , , ,

Using UICollectionLayoutListConfiguration with storyboards

Can you use the new UICollectionLayoutListConfiguration API in iOS 14 with collection views in storyboards? I have a UICollectionViewController in a storyboard, which I configure with a custom list layout below: var config = UICollectionLayoutListConfiguration(appearance: .plain) let layout = UICollectionViewCompositionalLayout.list(using: config) collectionView.setCollectionViewLayout(layout, animated: false) collectionView.dataSource = dataSource (In storyboards collection views can only be set […]

By weiran
Published
Categorised as ios, swift, uicollectionview Tagged , ,

UICollectionViewDiffableDataSource: Request for number of items in section 0 when there are only 0 sections in the collection view

I am trying to make a timeline where each section is a day and each day has many items (records). Here is my section (day) class: class YearMonthDay: Comparable, Hashable { let year: Int let month: Int let day: Int init(year: Int, month: Int, day: Int) { self.year = year self.month = month self.day = […]

UICollectionView for non-grid or semi-grid layout

I am trying to implement a multi-row sequence of items (like Video editing sequence in Final Cut Pro or Adobe Premiere pro shown below). While I one can always implement it using UIScrollView and placing custom views manually, it would be tedious particularly in reordering items and animating changes and also zooming across the timeline […]

tvOS: Unable to scroll through UICollectionView items when it is implemented like this: UICollectionView inside UITableView

I have implemented this: By following this tutorial. Here’s the problem: I am unable to scroll through the collection items. I think this has something to do with the fact that the project I followed is for iOS and my project is for tvOS. I’ve found a somewhat similar question. An answer linked to this […]

By Ahmed Ghrib
Published
Categorised as ios, swift, tvos, uicollectionview, uitableview Tagged , , , ,

How to create a grid layout with equal row heights using UICollectionViewCompositionalLayout

I’ve successfully been able to create a grid layout using UICollectionViewCompositionalLayout. However, I am unable to find a clever way of ensuring the UICollectionViewCell in each row in the grid are of the same height when their heights are dynamic. i.e. I want the cell to stretch to fill the available space height-wise in the […]

SWIFT: How to fix cell highlighter and make the whole collection view scroll instead of the highlighter?

I am building a TVOS app where I have this collectionView: The current cell (The cell which has scrolled to), gets highlighted in Orange. For example, here the user scrolls to the third cell: WHAT I AM TRYING TO ACHIEVE: When the user scrolls to another cell, I want the Orange square, to remain in […]

By Ahmed Ghrib
Published
Categorised as swift, tvos, uicollectionview, uiscrollview Tagged , , ,
1 2 3 7

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq