Open raulriera opened 8 years ago
+1 @raulriera were you able to find a workaround for this?
Hi,
I initially had cells with dynamic height like so:
func collectionView(collectionView: UICollectionView, layout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
let measureCell = MyCell.measureCell
let width = layout.collectionViewContentSize().width
measureCell.frame = CGRect(x: 0, y: 0, width: width, height: 0)
measureCell.layoutIfNeeded()
return measureCell.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize)
}
But it's still buggy, for example the cells don't resize properly when the collection view's width changes. I'm still looking for a better way.
@mbernson should we be pulling all image ages during view did load with the size in the json and creating objects prior to having to set the cells sizes? or would there be a way to reload the cells once the image was downloaded?
have to hard code for it. cannot auto change if cell loading images.
Same with me: How do I get cells with dynamic height? As far as I see there is no public property providing the item-width. What was the intention behind hiding it and how should I calculate my cell's height without access to such a value? My cells contain multiline-labels, all of which have dynamic content hence a dynamic height.
My fork solved the problem. I added a read-only dictionary caching the widths of the cells in all your sections.
@nickpodratz please help me... I have dynamic Height in header view and my layout is strugged layout.. this layout is working fine.I don't know what is the issue.. when I set static height then every label everything increased but when I set dynamic then some lable not increased.
Is there a way to achieve this? It seems the library wants to hardcode the size of the cells in the delegate :/