UICollectionView能否通过自动约束根据内容自动改变高度。
刚开始设置它的frame为CGRectZero,
var pictureView: UICollectionView = UICollectionView(frame: CGRectZero, collectionViewLayout: self.layout)
如里面cell个数为0,高度为0,里面cell个数为2高度为150等。
PHPz2017-04-17 17:57:00
Set the height constraint of UICollectionView in SB. Drag the constraint to the proxy class of UICollectionView in SB, and then change the value of this constraint every time data is passed in