title: Why am I having to manually set my view's frame in viewDidLoad?
body: <p>I have a pretty basic setup with a UINavigationController inside a UITabBarController. I'm wanting to programmatically layout the view of the rootViewController of that navcontroller, but when I look at self.view.frame inside viewDidLoad, I get this (in <strong>landscape</strong>, for example):</p>
  
  <pre><code>1. view frame: {{20, 0}, {748, 1024}} // looks like an odd portrait mode
  </code></pre>
  
  <p>Then I autorotate to Portrait, and I get this:</p>
  
  <pre><code>2. view frame: {{0, 0}, {768, 911}}
  </code></pre>
  
  <p>Then when I go back to Landscape, the frame is now this:</p>
  
  <pre><code>3. view frame: {{0, 0}, {1024, 655}}
  </code></pre>
  
  <p>And further autorotation events will flip-flop between frame values #2 &amp; #3. </p>
  
  <p>To get around the weirdness of #1, I'm currently doing this in viewDidLoad:</p>
  
  <pre><code>if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
      self.view.frame = CGRectMake(0, 0, 768, 911);
  } else {
      self.view.frame = CGRectMake(0, 0, 1024, 655);
  }
  </code></pre>
  
  <p>I feel like I'm obviously missing something here. Why would the default frame of the view not match the frame when it autorotates back to the same orientation? Does the view frame not get set to the initial orientation? Very confused...</p>
  
  <p>I should mention that none of the above, including my kludgy hack, changes anything visually. The reason I have the hack is so that when I layout my subviews into this view, they'll be based off of where I expect them to be, which is the top left corner just under the navigation bar.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>UPDATE: turning off all the autosizing stuff on the view changes result #1 to be:</p>
  
  <pre><code>view frame: {{0, 0}, {748, 1024}}
  </code></pre>
  
  <p>That seems a tiny bit closer, but still not matching #3.</p>