title: UIButtons stop working after rotation to landscape and then back to portrait
body: <p><strong>Overview</strong>: I have a strange error where buttons on the right side of my portrait view don't work after rotating to landscape and then back to portrait again.</p>
  
  <p><strong>Detail</strong>: Here is the scenario that produces the problem. If I start in portrait, all my buttons work. I rotate to landscape (see code below) and all buttons work. I rotate back to portrait and the buttons on the right 1/4 of the screen do no respond. It's like there is a transparent view that is covering those buttons. What is strange is that if part of the button sticks out to the left of that invisible barrier, I can tap on that part of the button but not on the right part that is "under" the "cover". If I were to rotate to landscape at this point, all the buttons in landscape work. When I rotate back to portrait, that invisible "cover" has moved over to the left another 1/4 to cover roughly 1/2 of the screen. If I rotate again to landscape (all buttons always work in landscape) and then back to portrait, the invisible "cover" has moved over another 1/4 to cover 3/4 of the screen. Eventually, none of my controls respond in portrait.</p>
  
  <p><strong>Important project information</strong>:</p>
  
  <ol>
  <li>This app is universal. The problem only happens in iPad portrait mode. The iPhone version never shows this problem in portrait (or landscape) mode.</li>
  <li>There are only 3 views: a container view (which is the root), portrait view, and landscape view.</li>
  <li>This app is ARC and targets 6.1. I have all the correct methods to handle rotation events.</li>
  </ol>
  
  <p>Here is the code for rotating the views:</p>
  
  <pre><code>[portrait removeFromSuperview];
  [landscape removeFromSuperview];
  
  UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation];
  if (currentOrientation==UIDeviceOrientationUnknown) {
      currentOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
  }
  if ((currentOrientation == 0) || (UIInterfaceOrientationIsPortrait(currentOrientation))) {
      [[self view] addSubview:portrait];
  }
  else {   //landscape
      [[self view] addSubview:landscape];
  }
  </code></pre>
  
  <p><strong>What I've tried</strong>:</p>
  
  <ol>
  <li>The questions I found that sound remotely similar mentioned checking for memory leaks using Instruments. I tried the zombies and allocations templates and didn't see anything odd (though this is the first I've used Instruments).</li>
  <li>EDIT: All of this is in the simulator, I haven't tested for this problem on a device yet.</li>
  </ol>
  
  <p>Thanks for your help.</p>