Placing a margin around each edge of the UICollectionView

后端 未结 7 1603
天涯浪人
天涯浪人 2020-12-14 18:18

When the UICollectionView is populated with items they always go right to the edges of the UICollectionView like so:

---------------
|X X X X X X X|
|X X X X         


        
7条回答
  •  囚心锁ツ
    2020-12-14 19:02

    Swift 2.0

    self.automaticallyAdjustsScrollViewInsets = false
    self.collectionView.contentInset = UIEdgeInsets(top: 10, left: 0, bottom: 0, right: 0)
    

提交回复
热议问题