UICollectionView cell subviews do not resize

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

    I had the same problem. Switching between two layouts did not resize the Pictures (UIImage) inside my cells. My Cells where build without a xib. And I used two different cell classes for each CollectionViewCustomLayout.

    I fixed this programatically with this:

    self.autoresizesSubviews = YES;
    

    in my UICollectionViewCell subclasses.

    But this only worked for me by adding the Picture as a cells backgroundpicture like this:

    cell.backgroundView[[UIImageView alloc] initWithImage: SumDummyImage ];
    

提交回复
热议问题