UICollectionView is too wide. How can i make it th

2019-03-05 14:19发布

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. What's a good way to fix this?

enter image description here

2条回答
冷血范
2楼-- · 2019-03-05 14:36

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

查看更多
Root(大扎)
3楼-- · 2019-03-05 14:52

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).

查看更多
登录 后发表回答