title: Creating NSLayoutConstraints in code
body: <p>This is my first attempt at using constraints, so please excuse the elementary question.</p>
  
  <p>I want to be able to set a series of constraints so that a subView is either less than 75% of the width of my view OR the width of my view.  So if my subView's width is greater than 75% of the view's width then set it to be the full width.  I want to do this to ensure the subView displays well on an iPhone and iPad.</p>
  
  <p>Is this possible using constraints?  I have set up two constraints, but how do I tell the constraints system which one to choose based on the width of my view, as I am not sure that this can be solved just using priorities?</p>
  
  <pre><code>// Ensure it's width is either the less than 3 quarters of the page width or the full page width (including the gutter margins)
  NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationLessThanOrEqual toItem:self attribute:NSLayoutAttributeWidth multiplier:0.75 constant:0];
  [self.constraints addObject:constraint];
  
  constraint = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
  [self.constraints addObject:constraint];
  
  // Add the constraints to the page
  [self addConstraints:self.constraints];
  </code></pre>
  
  <p>Any help greatly appreciated as getting rather bogged down.</p>
  
  <p>Dave</p>