title: ( Autoresizing mask ) flexible width of an image with fixed height
body: <p>I have been playing around with iPhone interface building using only code and not using IB.</p>
  
  <p>Now I'm facing the following problem:</p>
  
  <p>How can I set an image to have a width based on the main view it is located on and to let it have a margin of for example 50 pixels on both sides. ( it should also work with rotation so the width should be flexible ). </p>
  
  <p>I have tried setting the size with frame.size.width - 50 for example but this doesn't work when the screen rotates. Another thing I tried is using the autoresizing masks but I'm not completely understanding how this works.</p>
  
  <p>Does one still need to set a frame for an image or is this completely overruled by the autoresizing masks? And if it's overruled how can I give the image a fixed height and a flexible width?</p>
  
  <p>The book I'm using ( advanced iOS4 programming ) is not very clear in this matter and most examples I find on the net are for interface builder.</p>
  
  <p>Thanks for your time.</p>
  
  <p>Kind regards,
  Jasper</p>