Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
  2. layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
  3. layout.itemSize = CGSize(width: 60, height: 60)
  4. layout.estimatedItemSize = CGSize(width: 1, height: 1)
  5. collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
  6. let nib = UINib(nibName: "SimpleStackCollectionViewCell", bundle: nil);
  7. collectionView.register(nib, forCellWithReuseIdentifier: "MyCell")
  8. collectionView?.dataSource = self
  9. collectionView?.delegate = self
  10.  
  11. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  12. return CGSize(width: view.bounds.width, height: 500)
  13. }
  14.  
  15. open var estimatedItemSize: CGSize // defaults to CGSizeZero - setting a non-zero size enables cells that self-size via -preferredLayoutAttributesFittingAttributes:
  16.  
  17. let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
  18. layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
  19. layout.itemSize = CGSize(width: 60, height: 60)
  20. collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
  21. let nib = UINib(nibName: "SimpleStackCollectionViewCell", bundle: nil);
  22. collectionView.register(nib, forCellWithReuseIdentifier: "MyCell")
  23. collectionView?.dataSource = self
  24. collectionView?.delegate = self
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement