title: How to use NSNumber or CGFloat constant in Autolayout visual format language?
body: <p>I'm trying to set top and bottom paddings to a view in Autolayout using the visual format language. The code compiles and works if I write the paddings as integers in visual format string, but it fails when I try to replace it with a constant. Here's the error I'm getting:</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception
    'NSInvalidArgumentException', reason: 'Unable to parse constraint
    format:  It's not possible to set a space equal to the width or height
    of a view.  Perhaps you want to use a view as a spacer?
    [view1][spacer(==view1)][view2] 
    V:|-kTopAndBottomPadding-[messageTextView]-kTopAndBottomPadding-|</p>
  </blockquote>
  
  <p>And this is my code.</p>
  
  <pre><code>CGFloat const SPMTVC_kTopAndBottomPadding = 5.0;
  // ...
  
  // Create my own NSDictionary of variable bindings.
  NSDictionary *variableBindings = @{@"messageTextView" : _messageTextView,
      @"contentView" : self.contentView,
      @"kTopAndBottomPadding" : [NSNumber numberWithFloat:SPMTVC_kTopAndBottomPadding]};
  
  // Constraints in the horizontal axis.
  // Basically just pins the view to the left and right of superview.
  NSMutableArray *constraints = [[NSLayoutConstraint
      constraintsWithVisualFormat:@"H:|-0-[messageTextView(==contentView)]-0-|"
      options:NSLayoutFormatAlignAllLeading
      metrics:nil
      views:variableBindings] mutableCopy];
  
  // Constraints in vertical axis, give 5-point padding from superview's top &amp; bottom.
  [constraints addObjectsFromArray:[NSLayoutConstraint
      constraintsWithVisualFormat:@"V:|-kTopAndBottomPadding-[messageTextView]-kTopAndBottomPadding-|"
      options:NSLayoutFormatAlignAllTop
      metrics:nil
      views:variableBindings]];
  
  for (NSLayoutConstraint *constraint in constraints) {
      [self.contentView addConstraint:constraint];
  }
  </code></pre>
  
  <p>I think the error message means that the compiler thinks <code>kTopAndBottomPadding</code> is a <code>UIView</code>, when it's an <code>NSNumber</code> as defined in the dictionary. Is there a way to do this right?</p>