New in iOS 17 is NSCollectionLayoutDimension uniformAcrossSiblingsWithEstimate: method.
I have two collection view items positioned side by side in a a grid and would like to use this feature to give them equal heights.
I configure the items like so:
-Each "box" in grid is made up of two vertical items
-Title item configured with a fractional width of 0.5 and a estimated height. -Description item configured with a fractional width of 0.5 and a estimated height.
Then the "box" wraps both the "title item" and a description item vertically
NSCollectionLayoutSize *boxSize = [NSCollectionLayoutSize sizeWithFractionalWidth:0.5 estHeightUniformAcrossSiblings:estTitleHeight+estDescriptionheight]];
NSCollectionLayoutGroup *boxGroup = [NSCollectionLayoutGroup verticalGroupWithLayoutSize:boxSize
subitems:@[titleItem,descriptionItem]];
//Repeat the box twice to make a side by side grid.
//entireRowSize is fractional width of 1.0 and estimated height (not uniform across siblings).
NSCollectionLayoutGroup *sideBySideGroup = [NSCollectionLayoutGroup horizontalGroupWithLayoutSize:entireRowSize
repeatingSubitem:boxGroup
count:2];
But at runtime the grids do not have equal heights. It looks exactly the same as it was on iOS 16. Am I doing something wrong? Thanks in advance.