title: Custom CollectionView Layout
body: <p>I want to make a custom cell like this:</p>
  
  <p><a href="https://i.stack.imgur.com/Qdclo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qdclo.png" alt="enter image description here"></a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
  
      @IBOutlet var collectionView: UICollectionView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          collectionView.delegate = self
          collectionView.dataSource = self
      }
  
      func numberOfSectionsInCollectionView(collectionView: UICollectionView) -&gt; Int {
          return 1
      }
  
      func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
          return 3
      }
  
      func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
          let cell = collectionView.dequeueReusableCellWithReuseIdentifier("ImageCollectionViewCell", forIndexPath: indexPath) as! ImageCollectionViewCell
          if indexPath.row == 0 {
              cell.imgView.image = UIImage(named: "1")
          } else if indexPath.row == 1 {
              cell.imgView.image = UIImage(named: "2")
          } else {
              cell.imgView.image = UIImage(named: "3")
          }
          return cell
      }
  
      func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -&gt; CGSize {
          let screenWidth = UIScreen.mainScreen().bounds.width
          if indexPath.row == 0 {
              return CGSize(width: screenWidth / 2, height: screenWidth)
          } else if indexPath.row == 1 {
              return CGSize(width: screenWidth / 2, height: screenWidth / 2 - 20)
          } else {
              return CGSize(width: screenWidth / 2, height: screenWidth / 2 - 20)
          }
      }
  }
  </code></pre>
  
  <p>Is there any wrong with my code?</p>