material-components-ios icon indicating copy to clipboard operation
material-components-ios copied to clipboard

MDCChipCollectionViewFlowLayout support for horizontal scroll direction

Open algrid opened this issue 4 years ago • 1 comments

Feature Request/Suggestion

Does MDCChipCollectionViewFlowLayout support horizontal scroll? When I set

layout.scrollDirection = .horizontal

I get my layout broken, much like here https://github.com/material-components/material-components-ios/issues/5671 with overlapping items. It would be nice to have the horizontal scroll mode supported.

algrid avatar Apr 12 '21 17:04 algrid

@algrid, I have also encountered this issue when using horizontal scroll inside UITableViewCell(), was very frustrating, I was searching for solution and encountered this open issue.

I have solved this problem by setting the layout to be UICollectionViewFlowLayout() instead of MDCChipCollectionViewFlowLayout()

let layout = UICollectionViewFlowLayout()
layout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
layout.scrollDirection = .horizontal
collectionView.collectionViewLayout = layout
layoutIfNeeded()

YakavenkaM avatar May 12 '21 18:05 YakavenkaM