I am working programmatically (no storyboard) and am having trouble making layout.itemSize dynamic for different screen sizes. I get this error message:
add following delegate method to your collection view
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
UIImage *image;
long row = [indexPath row];
image = [UIImage imageNamed:_carImages[row]];
return image.size;
}
here a link which help you enter link description here