title: iOS: Programatically align button x pixels from bottom of screen
body: <p>I'm creating compatibility for iOS6 for an app made by someone else. I'm used to using making buttons/UI elements with autoresizing masks but I don't really know how they work when you're creating the button programatically.</p>
  
  <p>For example:</p>
  
  <pre><code>- (UIButton*) createSampleButton {
      UIButton* b = createSampleViewButton(CGRectMake(67, 270, 191, 45), 
                                            @"btn_shuffle", 
                                            @"btn_shuffle_active",
                                            self,
                                            @selector(sampleAction));
      b.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
      [self attachButton:b];
      return b;
  }
  </code></pre>
  
  <p>How can I change these buttons such that they'll be placed according to some scale/margin instead of arbitrarily choosing points until everything "looks right" ?</p>
  
  <p>I was thinking of something like:</p>
  
  <pre><code>- (UIButton*) createSampleButton {
      CGFloat height = self.bounds.size.height;
      CGFloat bottomBound = 80;
      UIButton* b = createSampleViewButton(CGRectMake(67, height-bottomBound, 191, 45), 
                                            @"btn_shuffle", 
                                            @"btn_shuffle_active",
                                            self,
                                            @selector(sampleAction));
      [self attachButton:b];
      return b;
  }
  </code></pre>
  
  <p>This would guarantee me that the button is placed 80 points from the bottom of the screen every time right? Is there a more graceful or purposeful way of doing this?</p>