uicollectionview

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

隐身守侯 提交于 2021-02-06 12:05:07
问题 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 row. Desired layout: Grid (3 x N) Variable height cells Each cell has the same height in a given row. (uses the max cell height in a row) Small divider line at the

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

孤街浪徒 提交于 2021-02-06 11:56:10
问题 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 row. Desired layout: Grid (3 x N) Variable height cells Each cell has the same height in a given row. (uses the max cell height in a row) Small divider line at the

UICollectionView animating cell size change causes undesired behavior

…衆ロ難τιáo~ 提交于 2021-02-05 12:45:13
问题 I have a UICollectionViewController that using a standard UICollectionViewFlowLayout to display a single vertical column of cells. I am attempting to create an expand/collapse animation on a cell when a cell is tapped. I use the following code to accomplish this: - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath (NSIndexPath *)indexPath { [self.feedManager setCurrentlySelectedCellIndex:indexPath.item]; [self.collectionView performBatchUpdates:nil completion

collectionview grid layout issue with different devices

不想你离开。 提交于 2021-01-29 20:46:02
问题 Hello i am creating App using Swift and i am creating grid view using Collectionview but i got different output on different devices here is the code for populating and setting layout of collectionview var imageArray = [UIImage]() var nameArray = ["General album","Videos","New album","Custom name album"] private var numberOfItemsInRow = 2 private var minimumSpacing = 10 private var edgeInsetPadding = 10 extension GalleryViewController:UICollectionViewDelegate,UICollectionViewDataSource

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

how to get table view row and push to viewController from collectionView that's inside a tableViewCell when tapped button inside collectionView cell

旧街凉风 提交于 2021-01-29 14:13:06
问题 My hierarchy like this UINavigationController->UITableviewController -> UITableViewCell -> UICollectionView-> UICollectionViewCell I have a button inside collectionView cell and I set like this: class AccountTypeCollectionViewCell: UICollectionViewCell { @IBOutlet weak var AccountTypeView: UIView! @IBOutlet weak var imgAccountType: UIImageView! @IBOutlet weak var lblAccountTypeTitle: UILabel! @IBOutlet weak var txtAccountTypeDescription: UITextView! @IBOutlet weak var btnMoreInfo: UIButton!

How to solve UICollectionViewFlowLayoutBreakForInvalidSizes

时间秒杀一切 提交于 2021-01-29 12:24:17
问题 I couldn't find an answer to this problem maybe because my code is different I don't know but in the end, I didn't found an answer, collectionView keep complaining about UICollectionViewFlowLayoutBreakForInvalidSizes and wants me to catch the err with symbolic breakpoint but I even with the breakpoint debugger not showing any information about the err, here is how I'm implementing collectionView if anyone could find the problem in my code please let me know The relevant

Wrong result when dynamically changing the height of the CollectionView to adapt to content size

主宰稳场 提交于 2021-01-29 11:29:25
问题 In my DetailViewController , I have two collectionViews and I am trying to change their height dynamically. I can successfully achieve this by changing the two heigh constraints IBOutlets with observers in DetailViewController . However, it does not work if, from DetailViewController I push another ViewController and then I go back. This is the code in "DetailViewController" @IBOutlet weak var deadlineCollectionViewHeight: NSLayoutConstraint! @IBOutlet weak var tasksCollectionViewHeight:

Self-sizing cells with UICollectionViewCompositionalLayout

蹲街弑〆低调 提交于 2021-01-29 05:11:57
问题 I have a view controller that displays a collection view with self-sizing cells. The collection view has one section that scrolls horizontally. It looks like this: Problem The collection view behaves unexpectedly when the view controller is presented using the default pageSheet style on iOS 13+. When pulling upward on the sheet, cells may appear to resize like the cell labeled "Rectify" below: When pulling upward on the sheet, the content may shift horizontally. Sometimes, cells may disappear