12

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.

enter image description here

Tom Kincaid
  • 4,887
  • 6
  • 47
  • 72
  • 1
    same problem here: http://stackoverflow.com/questions/19156979/ios7-setting-selectedindex-of-uitabbarcontroller-breaks-touch-events-along-rig – IlDan Oct 15 '13 at 09:24
  • Surprised there isn't more activity on this question .. I've written up another workaround at http://stackoverflow.com/a/19407311/242848 – brainjam Oct 16 '13 at 15:28

5 Answers5

15

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;
Josh Adams
  • 343
  • 3
  • 6
4

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;
}
Slavcho
  • 2,792
  • 3
  • 30
  • 48
2

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.

Community
  • 1
  • 1
Sulthan
  • 128,090
  • 22
  • 218
  • 270
1

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).

James Newbould
  • 136
  • 1
  • 7
0

I was also facing same issue and resolved it by adding following code inside app delegate's didFinishLaunchingWithOptions method.

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

window is the object of main interface .xib file.

Nazik
  • 8,696
  • 27
  • 77
  • 123