title: How to make uiview's width fit to the width of the parent view with some padding for both iphone and ipad using universal storyboard in xcode 6?
body: <p>I am learning constraints and Universal Storyboard in xcode 6 and having a little bit of difficulty here.</p>
  
  <p>Using Universal Storyboard,
  my goal is to create a UIView that fits perfectly on an iPad Simulator(768 x 1024) and iPhone 4 Simulator(<strong>_ x _</strong>) with lets say 50 pixel padding or margin on the left and right side.</p>
  
  <h3>Goal should look like this:</h3>
  
  <p><img src="https://i.stack.imgur.com/r06A5.png" alt="enter image description here"></p>
  
  <p>I am using Universal Storyboard and auto layout and I am getting the following result on the preview
  <img src="https://i.stack.imgur.com/N1ryN.png" alt="enter image description here"></p>
  
  <p>What I have done so far is just drag in a UIView into the Universal Storyboard editor, and then give it a width(768) that fills the iPad Screen, and then applied a width = 768, height = 200 constraints and a constraint to center horizontally and constraint to center vertically.</p>
  
  <h3>Observe result:</h3>
  
  <p>IPad screen fills width perfectly. However a closer look at my iPhone screen(Image 1), the UIView(in green)'s width do not fill to parent(its width is much bigger than its parent width)</p>
  
  <h3>Questions:</h3>
  
  <p>Problem 1)
  Is there a way to use Universal Storyboard to create a UIView that fills its width to its parent UIView both on the iPad and iPhone?</p>
  
  <p>Problem 2)
  If problem 1 is achievable, then how do you add a padding or margin left and right to the green UIView?</p>
  
  <p>thanks, and would appreciate any suggestions, comments, or opinions.</p>