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

后端 未结 2 1047
忘了有多久
忘了有多久 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 pinned all edges of your UICollectionview...check out here

    enter image description here

    By pinned all edges, you'll get equal height and width of screen

    0 讨论(0)
  • 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).

    0 讨论(0)
提交回复
热议问题