Two view in UICollectionView Cell. UIImageView and UIView . Like this:layout
But when I make constraints, I get an error:
Unable to simultaneously satisfy constraints
imgView.snp_makeConstraints { make in
make.top.equalTo(contentView)//.inset(K.Space.Small)
//make.bottom.equalTo(self.descView.snp_top)//.inset(K.Space.Small.negative())
make.left.right.equalTo(contentView)
}
descView.snp_makeConstraints { make in
make.bottom.equalTo(contentView)
make.left.right.bottom.equalTo(contentView)
make.height.equalTo(44)
make.top.equalTo(imgView.snp_bottom)
}
Error: error
Why?
edit: init collection view in vc viewDidLoad method. 【layout.itemSize 】 when first in ViewController error. but scroll down no error.
let collectionContentInset = UIEdgeInsets(top: 0, left: 12, bottom: 0, right: 12)
var collectionItemSize = DXLayoutSize(aspectRatio: 1.35)
collectionItemSize.containerInset = collectionContentInset
let layout = UICollectionViewFlowLayout()
layout.itemSize = collectionItemSize.itemSize()
layout.minimumInteritemSpacing = 6;
layout.minimumLineSpacing = 0;
collectionView = UICollectionView(frame: CGRectZero, collectionViewLayout: layout)
collectionView!.backgroundColor = DXUIColor.Background.color()
collectionView!.showsHorizontalScrollIndicator = false
collectionView!.contentInset = collectionContentInset