質問

When I rotate the device to portrait to landscape, the width of the tab bar is not extended and a gap is shown on the right hand side (where you see the text 'location').

Vertical orientation

Horizontal orientation

This problem has popped up after installing iOS 7 and wasn't present under iOS 6. It occurs on both the simulator and actual device.

I have noticed that when I start off in landscape mode, I can toggle between landscape and portrait with no problem.

役に立ちましたか?

解決

It has to deal with your auto-layout within Interface Builder I'm sure. IF you are making your view by using IB, then all you gotta do is click on the icon for your view controller, and then select all objects (command + a) and then just go to the icon that looks like this. enter image description here

Click on the one that shows the ball, and there is an option within this that says "Clear Constraints in Container." Click on that option, and after you do that, there should be another option that says "Add Missing Constraints in Container." This will add default options as to the size based on your items in your view controller.

Then just run the device and I'm sure it has fixed it.

I hope this helps you!

他のヒント

I created a new test project in XCode5 containing just the tab bar controller with two tabs. The autorotate and resize worked fine so I know that it must be a setting in my old project originally created in Xcode 4.

Next, I compared every setting in the IB against my original project. I notices that the "Autoresize Subviews" checkbox was not checked in the original project and was checked in the new one. After changing this, the resize works consistently again.

https://www.dropbox.com/s/th0tr812w1i3zlg/autoresizeSubviews.tiff

Strange that it made no difference in iOS 6.1 / XCode4!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top