uicollectionviewlayout

How to alig cell to top by Flow Layout in CollectionView

99封情书 提交于 2021-02-09 11:51:46
问题 In this code I am trying to change the size of the first cell of the UICollectionView and the others with the same size but in the first row only one cell is coming out when I want two to come out: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: if indexPath.row == 0 { return CGSize(width: collectionView.frame.width/1.5-2, height: collectionView.frame.width/1.5-2) } else { return CGSize(width: collectionView.frame.width/3.0-3, height: collectionView.frame

How to set data from bottom to top while chat using firebase

偶尔善良 提交于 2021-01-29 17:34:43
问题 I am working on firebase chat app, i designed my layout and implemented chat module successfully but, the problem is when i send text message it works fine and set text data to bottom of the collectionView but when i close my app and open it again the setting of text data mismatch and the last message comes upward. I tried all stack overflow questions and others try's but nothing happens any change. can't reverse data 回答1: Populate your array in reverse order, Because when you inserting data

Horizontal scrolling collection view cells not resizing based on content width

前提是你 提交于 2021-01-29 15:41:10
问题 I have initialized the collection view like this: override init(frame: CGRect){ let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal layout.itemSize = UICollectionViewFlowLayoutAutomaticSize layout.estimatedItemSize = CGSize(width: 100, height: 30) countryCollectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout) viewTitleLabel = UILabel() super.init(frame: frame) setupTableView() sortedDummyData = dummyData.sorted(by: <) } And I return size

Display UICollectionView with 2 columns of equal size square cells

耗尽温柔 提交于 2021-01-28 06:48:08
问题 I'm trying to accomplish the following: I've followed the answer in this question, but I get the image below: This is the code for the collection view controller: class MainMenuViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout { @IBOutlet var collectionView: UICollectionView! @IBOutlet weak var dateTimeLabel: MarqueeLabel! @IBOutlet weak var iconButton: UIButton! @IBOutlet var imageView: UIImageView! var iconButtonTimer:

UICollectionView Drag and Drop Folder Creation

自闭症网瘾萝莉.ら 提交于 2020-12-31 05:07:46
问题 I'm using UICollectionView to create a gallery app for iOS. I'd like for users to be able to drag and drop images to reorder the gallery and to create folders (similar to the home screen on the iPhone). I found the following tutorial to implement drag and drop reordering. However, I'm having an trouble figuring out where to start on the folder creation. What I'd like to do is implement the following scenarios: When an image is dragged around, it does not automatically reorder other images in

UICollectionView Drag and Drop Folder Creation

Deadly 提交于 2020-12-31 05:06:51
问题 I'm using UICollectionView to create a gallery app for iOS. I'd like for users to be able to drag and drop images to reorder the gallery and to create folders (similar to the home screen on the iPhone). I found the following tutorial to implement drag and drop reordering. However, I'm having an trouble figuring out where to start on the folder creation. What I'd like to do is implement the following scenarios: When an image is dragged around, it does not automatically reorder other images in

UICollectionView Drag and Drop Folder Creation

若如初见. 提交于 2020-12-31 05:06:19
问题 I'm using UICollectionView to create a gallery app for iOS. I'd like for users to be able to drag and drop images to reorder the gallery and to create folders (similar to the home screen on the iPhone). I found the following tutorial to implement drag and drop reordering. However, I'm having an trouble figuring out where to start on the folder creation. What I'd like to do is implement the following scenarios: When an image is dragged around, it does not automatically reorder other images in

UICollectionView Drag and Drop Folder Creation

Deadly 提交于 2020-12-31 05:05:58
问题 I'm using UICollectionView to create a gallery app for iOS. I'd like for users to be able to drag and drop images to reorder the gallery and to create folders (similar to the home screen on the iPhone). I found the following tutorial to implement drag and drop reordering. However, I'm having an trouble figuring out where to start on the folder creation. What I'd like to do is implement the following scenarios: When an image is dragged around, it does not automatically reorder other images in

DiffableDataSource: Snapshot Doesn't reload Headers & footers

喜夏-厌秋 提交于 2020-12-30 07:52:24
问题 I am using UICollectionViewDiffableDataSource for UICollectionView to display content in multiple sections. I am using Collection View Compositional Layout and Diffable Datasources link which was introduced at WWDC'19 to render the Multiple Section Layout of UICollectionView I have a simple setup, The Header for each section shows number of items in that section, and Footer shows the summary of all items of the section. section 1 Header --> January 2020 - 5 Trips section 1 item 1 --> Trip 1