使用 UICollectionView 实现下面的效果

途径 1,

简单直接, custom UICollection View Layout ,

横着码


途径 2,

UICollectionViewFlowLayout + UICollection View 的宽度控制

这样 layout 下,

    func doLayout(){
        collect.snp.makeConstraints { (m) in
            m.top.equalToSuperview().offset(95)
            m.leading.equalTo(title)
            m.height.equalTo(40)
            // item width * 3 + spacing * 2
            m.width.equalTo(80 * 3 + 33)
        }
        
    }

邓轻舟
384 声望13 粉丝

我叫邓江洲,准备面试中