Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Created March 3, 2015 20:40
Show Gist options
  • Save jpotts18/3d31e17e656727d07fc8 to your computer and use it in GitHub Desktop.
Save jpotts18/3d31e17e656727d07fc8 to your computer and use it in GitHub Desktop.
// MARK: UICollectionViewFlowDelegate methods
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
var borderWidth = COLUMN_NUMBER * BORDER_WIDTH
var width:CGFloat = CGFloat((collectionView.frame.width - borderWidth) / COLUMN_NUMBER)
return CGSize(width: width, height: width) // square
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment