我想在第一部分进行水平滚动,在collectionView的第二部分进行垂直滚动。我使用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 和我不想将嵌套的集合视图一起使用或与tableViews一起使用!!