Skip to content

Instantly share code, notes, and snippets.

@MoathOthman
Last active April 28, 2016 09:33
Show Gist options
  • Save MoathOthman/5aca6cc64fedeaa137ce to your computer and use it in GitHub Desktop.
Save MoathOthman/5aca6cc64fedeaa137ce to your computer and use it in GitHub Desktop.
Snippet for sizing the collectionViewCell depending on the screen size
Collection View Cell Size
Snippet for sizing the collectionViewCell depending on the screen size
Given its original designed for 4.7" inches
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
return CGSizeMake(<#currentWidthfor4.7inches#> *self.view.bounds.size.height/667.0, <#height#>*self.view.bounds.size.width/375.0);
}
drag-drop to the "Code snippet Library" in Xcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment