我在 iOS Swift 中使用 Material design Filter 芯片。我试图在集合视图中加载cellForItemAt中的数据时动态选择特定的芯片视图。文档对此一无所知。
我在cellForItemAt中应用了这个但没有工作
collectionView.selectItem(at: indexPath, animated: true, scrollPosition: .centeredVertically)
我正在以这种方式使用集合视图委托 cellForItemAt
let cell: MDCChipCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier:
"identifier", for: indexPath) as! MDCChipCollectionViewCell
let chipView: MDCChipView = cell.chipView