title: Programmatic Vertical Alignment of UIPageControl in Superview using NSLayoutConstraint
body: <p>Up until now, I was able to avoid using Auto Layout, so apologies for the (potentially) stupid question.</p>
  
  <ul>
  <li>I have a ViewController that is being built programmatically (e.g., no IB).</li>
  <li>I have a UIPageControl object that is in the view hierarchy of the viewController's view (e.g., <code>addSubview:</code>)</li>
  <li>I need, rather, want to align a UIPageControl object against the bottom edge of the UIViewController's main view. </li>
  <li>I want the UIPageControl to be centered horizontally, but 20-40 pixels from the bottom's edge.</li>
  </ul>
  
  <p>Here's some sample code I have that is creating the UIPageControl and displaying it, but not in the correct location at all.</p>
  
  <pre><code>self.pageControl = [[UIPageControl alloc] init];
  self.pageControl.numberOfPages = ...;
  self.pageControl.otherAttributes = ...;
  [self.view addSubview:[self pageControl]];
  
  UIPageControl *pageControl = [self pageControl];
  UIView *view = [self view];
  NSDictionary *constaintDictionary = NSDictionaryOfVariableBindings(view, pageControl);
  
  
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:pageControl
                                                       attribute:NSLayoutAttributeCenterX
                                                       relatedBy:NSLayoutRelationEqual
                                                          toItem:self.view
                                                       attribute:NSLayoutAttributeCenterX
                                                      multiplier:1
                                                        constant:0]];
  
  [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[pageControl]-20-[view]"
                                                                    options:0
                                                                    metrics:nil
                                                                      views:constaintDictionary]];
  </code></pre>
  
  <p>Like I said, I'm really new to auto-layout, so I'm not sure if I'm even implementing these methods properly.</p>
  
  <p>Thank you for your assistance ahead of time.</p>