title: Change scroll direction in UICollectionView
body: <p>I have a UICollectionView which I have setup, everything works fine (selection, headers, etc), however, I want to change the scroll direction in some situations.</p>
  
  <p>In short if I go into the story board and change the scrollDirection it works fine but I want to do it programatically!</p>
  
  <p>I have tried to change the scroll direction of the collection view directly with something like</p>
  
  <pre><code>    [myCollectionView setScrollDirection:....and so on.......
  </code></pre>
  
  <p>But this does not work, I can not find scrollDirection or similar in there.</p>
  
  <p>I have also tried to setup a flow layout but I am sure i am doing this wrong (i.e. trying to set a ViewLayout to a FlowLayout).</p>
  
  <pre><code>    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
      [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
      [myCollectionView setCollectionViewLayout:flowLayout];
  </code></pre>
  
  <p>This crashes with a lot of Constraint problems and I suspect I need to do a lot more work with the flowLayout (from what I have found it is a bit above me right now).</p>
  
  <p>It should also be noted that I am using a custom cell, headers and footers.</p>
  
  <p>In short is there an easy way to do this or not? OR does anyone know a good Flow Layout tutorial?</p>
  
  <p>EDIT</p>
  
  <p>I setup the collection view as such;</p>
  
  <pre><code>[myCollectionView setDataSource:self];
  [myCollectionView setDelegate:self];
  </code></pre>
  
  <p>I implement these delegate methods and all work fine</p>
  
  <pre><code>viewForSupplementaryElementOfKind
  numberOfSectionsInCollectionView
  numberOfItemsInSection
  cellForItemAtIndexPath
  didSelectItemAtIndexPath
  </code></pre>
  
  <p>I have added the DataSource and Delegate to the .h and also the FlowLayout delegate BUT I am not sure what I should also have for the latter.</p>
  
  <p>Most of the visual layout is done in Story Board, there are a few things such as Font, size and colour which I do programatically.</p>
  
  <p>ANOTHER EDIT</p>
  
  <p>This is the error when I try to change the FlowLayout, I also get this when I try and invalidate the layout.</p>
  
  <p>Unable to simultaneously satisfy constraints.
      Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) </p>
  
  <pre><code>"&lt;NSAutoresizingMaskLayoutConstraint:0x89967f0 h=--&amp; v=--&amp; V:[menuCell:0x8991700(50)]&gt;",
  "&lt;NSLayoutConstraint:0x8991200 menuCell:0x8991700.bottom == UILabel:0x8992be0.bottom + 100&gt;",
  "&lt;NSLayoutConstraint:0x898fd50 UILabel:0x8992be0.top == menuCell:0x8991700.top + 3&gt;"
  </code></pre>
  
  <p>Will attempt to recover by breaking constraint 
  </p>
  
  <p>Break on objc_exception_throw to catch this in the debugger.
  The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.</p>