[ad_1]
I’m utilizing a group view compositional structure to show a cell with two labels that may develop in peak, relying on the content material of the labels. All the pieces else within the cell is mounted.
I make a piece like this:
let merchandise = NSCollectionLayoutItem(
layoutSize: NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1)))
let group = NSCollectionLayoutGroup.vertical(
layoutSize: NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1),
heightDimension: .estimated(300)),
subitems: [item])
let part = NSCollectionLayoutSection(group: group)
The issue is, it is both too large, or too small, however the right peak is rarely being calculated.
My assumption is that this is because of the truth that I’m setting the textual content for the label inside a configure
methodology however not in the course of the cell initialization.
let cell = collectionView.dequeueReusableCell(
reusableCell: MyCustomCell.self,
indexPath: indexPath)
cell.configure(viewModel: viewModel)
Any concepts how I can repair it? I attempted invalidating the structure or reloading the info to re-calculate the peak, however it did not assist.
[ad_2]