title: Pinterest style layout iOS storyboards
body: <p>I want to create a design like so :-</p>
  
  <p><a href="https://i.stack.imgur.com/xhiAb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xhiAb.png" alt="enter image description here"></a></p>
  
  <p>I am using storyboards and i cannot make this thing work. I have a simple collection view as of now and it works fine except all cells show up twice. Is there a way i can achieve this by not using any library and having random heights for cells?</p>
  
  <p>This is my storyboard :-</p>
  
  <p><a href="https://i.stack.imgur.com/uR65v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uR65v.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><strong>Mycollectioncontroller</strong></p>
  
  <pre><code>public MyCollectionController(IntPtr handle) : base(handle)
  {
  
  }
  
  public override void ViewDidLoad ()
  {
      base.ViewDidLoad ();
      data = MakeDataForRecyclerView(pageIndex);
  }
  
  public override nint NumberOfSections (UICollectionView collectionView)
  {
      return 1;
  }
  
  public override nint GetItemsCount(UICollectionView collectionView, nint section)
  {
      return data.Length;
  }
  
  public override void ItemSelected (UICollectionView collectionView, NSIndexPath indexPath)
  {
      var message = string.Format ("You clicked on {0}!", cell.Title);
      new UIAlertView ("Clicked", message, null, "Okay", null).Show ();
  }
  
  public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
  {
      cell = (MyCollectionCell) collectionView.DequeueReusableCell ("My_Collection_Cell", indexPath);
      var tag = data[indexPath.Row];
      cell.PopulateData (tag.Title, tag.ThumbnailPath);
      return cell;
  }
  
  public override void ItemHighlighted(UICollectionView collectionView, NSIndexPath indexPath)
  {
      var cell = collectionView.CellForItem(indexPath);
      cell.ContentView.BackgroundColor = UIColor.Yellow;
  }
  
  public override void ItemUnhighlighted(UICollectionView collectionView, NSIndexPath indexPath)
  {
      var cell = collectionView.CellForItem(indexPath);
      cell.ContentView.BackgroundColor = UIColor.White;
  }
  
  public override bool ShouldHighlightItem(UICollectionView collectionView, NSIndexPath indexPath)
  {
      return true;
  }
  
  private Models.DummyModel[] MakeDataForRecyclerView(int startPosition)
  {
      List&lt;Models.DummyModel&gt; listOf4Item = new List&lt;Models.DummyModel&gt;();
  
      for (int i = startPosition * 4; i &lt; Math.Min((4 * startPosition) + 4, AppDelegate.myList.Count); i++)
      {
          listOf4Item.Add(AppDelegate.myList.ElementAt(i));
      }
  
      return listOf4Item.ToArray();
  }
  </code></pre>
  
  <hr>
  
  <p><strong>MyCollectionCell</strong></p>
  
  <pre><code>public MyCollectionCell (IntPtr handle) : base (handle)
  {
  
  }
  
  public void PopulateData(string title, string placeholderURL)
  {
      //lblTitle.Text = title;
      placeholderImg.SetImage(url: new NSUrl(placeholderURL),
                              placeholder: UIImage.FromFile("ic_apptitle.png"));
  }
  </code></pre>