Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 在uiCollectionview的每个部分上制作不同的滚动条_Swift_Scroll_Uicollectionview - Fatal编程技术网

Swift 在uiCollectionview的每个部分上制作不同的滚动条

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

我想在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我不想同时使用嵌套的CollectionView或与TableView一起使用

我认为如果不在第一个单元格部分嵌套另一个集合视图/表视图,就无法完成此操作。相关报道:Thx,但如果
uicollectionview
不能,我确实为苹果公司感到抱歉。@SAt你找到解决方案了吗?