I have a very simple app consisting of a single view. Everything works fine, the app rotates and buttons on the right side of the screen are clickable. I'm using iOS 7 and Xcode 5.
If I go into the storyboard and select the view then do Editor > Embed In > Tab Bar Controller, now when the app rotates from portrait to landscape, the right side of the app is not clickable. It seems to be exactly 768 pixels from the left where it stops working, so it makes me think there's something in the app that didn't rotate. What could be wrong?
It's just a basic single view wizard app that I put some UI elements on it to test. The only thing that makes it stop working is embedding in the tab bar.
Here is the whole project: https://github.com/tomkincaid/rotate
Update: I had originally used the same iPhone storyboard for both iPhone and iPad and thought this might be the issue. However, I created a new iPad storyboard and it has the same issue.
Another Update: If I put the view inside a navigation controller, it works. So View works and Tab>Nav>View works, but Tab>View doesn't work.
I had the same problem. Putting the following code in my view controller's viewDidLoad fixed it:
self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Just put the following code in you TabBarViewController class.
- (void)viewDidLayoutSubviews
{
// fix for iOS7 bug in UITabBarController
self.selectedViewController.view.superview.frame = self.view.bounds;
}
To elaborate this answer, you can achieve the same result by editing the source code of the storyboard.
Replacing
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
with
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
for the view of the view controller that causes the problems.
In the list of view controllers on the left hand side navigate to the views/view controllers affected, drag the view to underneath the first responder so that it is disassociated to the view controller's view.
Then go to the layout tab on the right hand side, select all 4 anchors and both sets of resizing arrows (horizontal + vertical).
Then drag the view back to where it was originally (just below the view controller).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With