title: Why am I unable to position my view with a gradient sublayer with Auto Layout? It doesn't show up
body: <p>I have the following code to create a view with a gradient background (using a sub layer) and then add it as a subview:</p>
  
  <pre><code>// Add a gradient overlay to make caption more legible (add a little extra to the sides to make it continue over the spacing between view controllers)
  UIView *gradientView = [[UIView alloc] init];
  gradientView.translatesAutoresizingMaskIntoConstraints = NO;
  gradientView.userInteractionEnabled = NO;
  
  // Add the gradient effect
  CAGradientLayer *gradient = [CAGradientLayer layer];
  gradient.frame = gradientView.bounds;
  gradient.colors = @[(id)[UIColor colorWithWhite:0.0 alpha:0.0].CGColor,
                      (id)[UIColor colorWithWhite:0.0 alpha:0.65].CGColor,
                      (id)[UIColor colorWithWhite:0.0 alpha:0.8].CGColor];
  gradient.locations = @[@0.0, @0.77, @1.0];
  
  [gradientView.layer insertSublayer:gradient atIndex:0];
  
  [self.view addSubview:gradientView];
  
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:gradientView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0]];
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:gradientView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]];
  
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:gradientView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]];
  
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:gradientView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
  </code></pre>
  
  <p>However, when I run it, nothing shows up. If I set it up with a frame instead of Auto Layout, it does work. Why am I unable to do this with Auto Layout?</p>