Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

rotation - iOS 7 When Rotating View in Tab Bar, Right Side of View is Not Clickable

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...