Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.47 KB | None | 0 0
  1. func collectionView(_ collectionView: UICollectionView,
  2.                         layout collectionViewLayout: UICollectionViewLayout,
  3.                         sizeForItemAt indexPath: IndexPath) -> CGSize {
  4.         let paddingSpace = sectionInsets.left * (itemsPerRow + 1) * 2
  5.         let availableWidth = view.frame.width - paddingSpace
  6.         let widthPerItem = availableWidth / itemsPerRow
  7.        
  8.         return CGSize(width: widthPerItem, height: widthPerItem)
  9.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement