title: NSLayoutConstraints and setting the width/height of a view dynamically
body: <p>I have a question about setting the size of a view to which i'm applying some layout constraints.<br>
  How can I define the size of the view without defining its frame?</p>
  
  <p>I'm trying to create a view that has its height fixed and has an origin at the screen origin. It fills the width of the view, so that when the device rotates the view extends to the width of the screen. This is what I've got so far...</p>
  
  <pre><code>self.containerView = [[HitTestContainerView alloc] init];
  [self.containerView setBackgroundColor:[UIColor redColor]];
  [self.view addSubview:self.containerView];
  
  NSDictionary *viewsDictionary = @{@"view":self.containerView};
  NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-50-[view]-250-|" options:0 metrics:nil views:viewsDictionary];
  NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:0 metrics:nil views:viewsDictionary];
  [self.view addConstraints:verticalConstraints];
  [self.view addConstraints:horizontalConstraints];
  </code></pre>
  
  <p>The problem is I can't get anything to show up on the screen unless I set the frame of that <code>containerView</code>. What is the correct way to do this without using Interface Builder?</p>