title: How to create custom UICollectionViewCell using Storyboard in iOS?
body: <p>I have a <code>UIViewController</code> in which I have a <code>UICollectionView</code>.The cells of the <code>UICollectionView</code> need to be images so I understand that I need to subclass the <code>UICollectionViewCell</code> class. So basically, I need a UIViewController which has a UICollectionView that has a custom UICollectionViewCell. I am using a storyboard and when I need to create a custom <code>UITableVieCell</code>, I do the following:</p>
  
  <ul>
  <li>Create a subclass of <code>UITableViewCell</code></li>
  <li>Set this subclass as the class for the <code>UITableViewCell</code> in the storyboard</li>
  <li>Set a reuse identifier.</li>
  <li>Import this class in my view controller implementation, declare a cell of this subclass and proceed.</li>
  </ul>
  
  <p>But when I follow the same for a <code>UICollectionViewCell</code>, <strong>for eg.</strong> I create a subclass called <code>CustomCollectionViewCell</code>, and declare it in the <code>cellForItemAtIndexPath</code> like </p>
  
  <pre><code>CustomCollectionViewCell *cell = (CustomCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
  
  NSLog(@"%@",cell);
  </code></pre>
  
  <p>This logs <code>&lt;UICollectionViewCell: 0x137529010; frame = (10 10; 300 164); layer = &lt;CALayer: 0x170220880&gt;&gt;</code> no matter what I do. I can just not initialize my custom <code>UICollectionViewCell</code> class and hence cannot add the images.</p>
  
  <p>I looked at other StackOverflow answers and read answers saying not to do this:</p>
  
  <pre><code>[self.collectionView registerClass:[CustomCollectionViewCell class] forCellWithReuseIdentifier:@"Cell"];
  </code></pre>
  
  <p>if I'm using storyboard, so I commented it out.</p>
  
  <p>All the reuse identifiers, outlets etc have been set. I can't seem to find where the error is.</p>
  
  <p>Any help is appreciated.</p>