title: Getting the correct frame in willRotateToInterfaceOrientation when switching xib
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12412240/ios-bounds-change-after-rotating-to-landscape-then-back-to-portrait">iOS bounds change after rotating to landscape, then back to portrait</a>  </p>
  </blockquote>
  
  
  
  <p>I have an UIViewController that, depending on its orientation, switches the underlying xib from landscape to portrait and vice versa. </p>
  
  <p>The mechanics for this is quite simple. In willRotateToInterfaceOrientation I check for the orientation we're changing to and I load the correct xib and call [self viewDidLoad]. </p>
  
  <p>The result is that all my views get the correct outlet and all the standard UI components look fine.</p>
  
  <p>The problem arises with a custom component that I lay out again during rotation. Its problem is that when I read the frame of that component, the resulting frame in willRotateToInterfaceOrientation isn't the one expected to be in the new controller.. it's something in between the two, just like it was a frame of the animation.</p>
  
  <p>Has this ever happened to anyone? Is there a better way to accomplish this?</p>