title: How to utilise Constraints - FluentConstraints and FluentLayouts for Xamarin.iOS
body: <p>I have a collection view in iOS that has been generated programmatically i.e. it doesn't have a nib. It is then being injected into a view on a page. I am using Xamarin Studio and MVVM Cross. When I run the app the collection is generated and injected in the right position. But as I scroll down and the scrollbar hits the bottom of the collection view it carries on scrolling but the scroll bar goes off the bottom of the screen.</p>
  
  <p>I'm thinking the collection view isn't adhering the dimensions of the view im injecting it into so its height is too high. Can I set the height of the collection in code?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok as im using MVVM I have found a way of achieving what I have explained in my question.</p>
  
  <p>I have managed to get my collection view to adhere to the top and bottom of the view it is injected into. I have done this by using the Cirrious library <strong>Cirrious.FluentLayouts.Touch</strong> great post on here from Stuart Lodge <a href="http://slodge.blogspot.co.uk/2013/07/playing-with-constraints.html" rel="nofollow">http://slodge.blogspot.co.uk/2013/07/playing-with-constraints.html</a>. With this I have eradicated the need to specify a height on the collection view and instead told it to stick to the top and bottom of the parent view.</p>
  
  <p>e.g.</p>
  
  <pre><code>//Add constraints between collection view and its container in page
  parentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
  parentView.AddConstraints(
    collectionsView.AtTopOf(parentView,0),
    collectionsView.AtBottomOf(parentView,0),
    collectionsView.AtLeftOf(parentView,0),
    collectionsView.AtRightOf(parentView,0)
  );
  </code></pre>