UICollectionView cell subviews do not resize

后端 未结 10 1745
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 00:25

In a CollectionView, some cells should have an additional subview or layer. The CollectionView can be told to resize it\'s cells, thus all content

10条回答
  •  没有蜡笔的小新
    2020-11-29 01:04

    *override func awakeFromNib() {
        super.awakeFromNib()
    
        self.contentView.autoresizingMask.insert(.FlexibleHeight)
        self.contentView.autoresizingMask.insert(.FlexibleWidth)
    }
    

    This worked for me.. This code goes inside of your subclassed UICollectionViewCell.swift file (where your code involving the custom cell is located)

    Swift solution*

提交回复
热议问题