Created
April 13, 2019 23:20
-
-
Save JeremyXue77/ed23121d6659156b8859421619795afa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension ViewController: UICollectionViewDelegateFlowLayout { | |
| func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | |
| let width = collectionView.bounds.width / CGFloat(row * 2 - 1) | |
| return CGSize(width: width, height: width) | |
| } | |
| func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { | |
| let width = collectionView.bounds.width / CGFloat(row * 2 - 1) | |
| return width | |
| } | |
| func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { | |
| let width = collectionView.bounds.width / CGFloat(row * 2 - 1) | |
| return width | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment