title: How to change the Size of collectionView in iOS
body: <p>I am new to iOS and Xamarin. I have Create <code>CollectionView</code> with full <code>Width</code> and <code>Height</code> of the Main Frame. Now I want to Change the CollectionView size with <code>150</code> <code>Height</code> and full <code>Width</code> to parent with <code>Horizontal Scroll</code>. I try to change the code but it not work.</p>
  
  <p><strong>CollectionView with Full Screen :</strong></p>
  
  <pre><code> UICollectionViewDataSource source;
          UICollectionViewFlowLayout layout;
          UICollectionView collectionView;
  
      protected ViewController(IntPtr handle) : base(handle)
      {
          layout = new UICollectionViewFlowLayout
          {
              SectionInset = new UIEdgeInsets(20, 5, 5, 5),
              MinimumInteritemSpacing = 5,
              MinimumLineSpacing = 5,
              ItemSize = new SizeF(100, 100),
  
  
          };
  
          collectionView = new UICollectionView(UIScreen.MainScreen.Bounds, layout);
          collectionView.ContentSize = new CGSize(View.Frame.Size.Width, View.Frame.Size.Height);
          collectionView.BackgroundColor = UIColor.White;
          source = new UICollectionViewDataSource();
  
          collectionView.RegisterClassForCell(typeof(TextCell), TextCell.CellId);
          collectionView.Source = source;
      }
  </code></pre>
  
  <p><strong>Output :</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/2m8gU.png" rel="nofollow"><img src="https://i.stack.imgur.com/2m8gU.png" alt="enter image description here"></a></p>
  
  <p><strong>I Expect :</strong></p>
  
  <blockquote>
    <p>Width = Parent Width,</p>
    
    <p>Height = 150</p>
  </blockquote>
  
  <p>So I change the code to this</p>
  
  <pre><code>layout = new UICollectionViewFlowLayout
              {
                  SectionInset = new UIEdgeInsets(20, 5, 5, 5),
                  MinimumInteritemSpacing = 5,
                  MinimumLineSpacing = 5,
                  ItemSize = new SizeF(100, 100),
  
  
              };
  
              collectionView = new UICollectionView(UIScreen.MainScreen.Bounds, layout);
              collectionView.ContentSize = new CGSize(View.Frame.Size.Width, 150);
              collectionView.BackgroundColor = UIColor.White;
              source = new UICollectionViewDataSource();
  
              collectionView.RegisterClassForCell(typeof(TextCell), TextCell.CellId);
              collectionView.Source = source;
  </code></pre>
  
  <p>but also it display in Full Screen.</p>
  
  <p>Any Help be Appreciated.</p>