title: Equal spacing for collectionview items in ios
body: <p>I using collection view controller to display images like in gallery. Now I struck with spacing. I cant set equal spacing in collection view..</p>
  
  <pre><code>- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
      return 0;
  }
  
  - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
      return 0;
  }
  
  - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  {
      return UIEdgeInsetsMake(0, 0, 0, 0);
  }
  - (CGSize)collectionView:(UICollectionView *)collectionView
                    layout:(UICollectionViewLayout *)collectionViewLayout
    sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  {
      return CGSizeMake(106.0f, 106.0f);
  }
  </code></pre>
  
  <p>This is my code.. cell width <strong>106</strong> but the <strong>imageview</strong> width is <strong>104.0f</strong> I gave 2 points spacing left side of the image view now I got solution as below image.
  <img src="https://i.stack.imgur.com/eedat.png" alt="enter image description here"></p>
  
  <p>Pls help me to fix this problem...</p>