Swift 在uiCollectionview的每个部分上制作不同的滚动条
我想在collectionView的第一部分做水平滚动,在第二部分做垂直滚动。我使用了Swift 在uiCollectionview的每个部分上制作不同的滚动条,swift,scroll,uicollectionview,Swift,Scroll,Uicollectionview,我想在collectionView的第一部分做水平滚动,在第二部分做垂直滚动。我使用了collectionviewlayout,但我还不能 func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { if indexPath.section == 0 { if let lay
collectionviewlayout
,但我还不能
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if indexPath.section == 0 {
if let layout = myCollectionView.collectionViewLayout as? UICollectionViewFlowLayout {
layout.scrollDirection = .horizontal
}
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell1", for: indexPath) as! CategoryCollectionViewCell
return cell
} else {
if let layout = myCollectionView.collectionViewLayout as? UICollectionViewFlowLayout {
layout.scrollDirection = .vertical
}
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell2", for: indexPath) as! CollectionViewCell
return cell
}
}
我正在使用swift 4和我不想同时使用嵌套的CollectionView或与TableView一起使用我认为如果不在第一个单元格部分嵌套另一个集合视图/表视图,就无法完成此操作。相关报道:Thx,但如果
uicollectionview
不能,我确实为苹果公司感到抱歉。@SAt你找到解决方案了吗?