UICollectionView is too wide. How can i make it the width of the device?

后端 未结 2 1085
忘了有多久
忘了有多久 2021-01-25 23:30

I created a new UICollectionView in the storyboard. My problem is that the cells try and fit a larger width than the width of the device, so the ones on the right get cut off. W

2条回答
  •  忘了有多久
    2021-01-26 00:24

    You need to add the proper constraints to your collection view. If you want it to be the width of the screen, then add 0 length spacing constraints to both edges of the controller's self.view (top and bottom as well if you want it full height).

提交回复
热议问题