title: How to automatically group items in sections in UICollectionView?
body: <p>I have a fixed number of Sections in a UICollectionView</p>
  
  <pre><code>-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
  
  return 3;
  
  }   
  </code></pre>
  
  <p>and a fixed number of items per section</p>
  
  <pre><code>-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  
  return 9;
  
  }
  </code></pre>
  
  <p>The first 9 items are properly displayed through a plist (with cellForItemAtIndexPath) in the first section. However the second and third sections only display the items from the first section, instead of displaying the required items. </p>
  
  <p>So, I'm trying to display all the items from the plist, and have them grouped automatically into sections (of 9 items).</p>
  
  <p>I'm fairly new to Objective-C and have been struggling with this for quite a while, so I'd really appreciate your help.</p>
  
  <pre><code>-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
  
  
          xx.image = [UIImage imageNamed:[imagePath objectAtIndex:indexPath.item]];
  
  
      }
  </code></pre>