Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
- layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
- layout.itemSize = CGSize(width: 60, height: 60)
- layout.estimatedItemSize = CGSize(width: 1, height: 1)
- collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
- let nib = UINib(nibName: "SimpleStackCollectionViewCell", bundle: nil);
- collectionView.register(nib, forCellWithReuseIdentifier: "MyCell")
- collectionView?.dataSource = self
- collectionView?.delegate = self
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
- return CGSize(width: view.bounds.width, height: 500)
- }
- open var estimatedItemSize: CGSize // defaults to CGSizeZero - setting a non-zero size enables cells that self-size via -preferredLayoutAttributesFittingAttributes:
- let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
- layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
- layout.itemSize = CGSize(width: 60, height: 60)
- collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
- let nib = UINib(nibName: "SimpleStackCollectionViewCell", bundle: nil);
- collectionView.register(nib, forCellWithReuseIdentifier: "MyCell")
- collectionView?.dataSource = self
- collectionView?.delegate = self
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement