UICollectionView cell subviews do not resize

后端 未结 10 1729
佛祖请我去吃肉
佛祖请我去吃肉 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 00:48

    As an alternative to enabling AutoResizingMask, for custom UICollectionViewLayouts that have variable height for example where you are setting some constraints manually and need translatesAutoresizingMaskIntoConstraints to remain NO, you can add the following to layoutSubviews in the cell:

    self.contentView.frame = self.bounds;
    

    This worked to fix all of my custom collection view layouts that had problens with Xcode 6.

提交回复
热议问题