如何在表格视图单元格内创建集合视图

问题描述 投票:0回答:1

如何从表视图单元格以及集合视图单元格图像内部创建具有不同单元格大小的此类集合视图,需要从网址单元格How to create like this collection view with different cell size inside table view下载>

我尝试了下面的代码,但最后2个小单元格出现了,并且从URL集合视图下载的图像在手动触摸集合视图之前没有加载

 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        let cVWidth = collectionView.frame.width
        let biggerCellWidth = (cVWidth / 2.5) - 5
        if indexPath.row == 2 || indexPath.row == 3 {
            let testValue:CGFloat = 3
            return CGSize(width: (biggerCellWidth / 2) - testValue  , height: (biggerCellWidth / 2) - testValue )
        }
        return CGSize(width: biggerCellWidth, height: biggerCellWidth)
    }

[如何在表视图单元格内部以及集合视图单元格图像内部创建具有不同单元格大小的这种集合视图,需要从下面的代码尝试从url单元下载,但最后2个...

ios swift uitableview uicollectionview uicollectionviewcell
1个回答
0
投票
要在表视图内创建集合视图,请转到此link
© www.soinside.com 2019 - 2024. All rights reserved.