Pheepster
Pheepster

Reputation: 6367

XCode6 Interface Builder iPad issues

I am trying to build a view controller nib using XCode 6 Interface Builder. Currently my view controller contains only a view that I have set a dark gray background color. When I load it in an iPhone simulator, everything works as expected, that is the view fills the screen with the dark gray background color. When I load in iPad, the view is shifted off to the left and upward.

For iPhone size classes, I am using w:Compact h:Regular.

For iPad size classes I am using w:Regular h:Any.

In the Interface Builder preview, both iPhone and iPad look as they should.

Here is what it looks like in the iPad simulator:

enter image description here

Something else worth noting. The view controller shown in the image is the entire view controller. It's not just partially visible. Any ideas why this is happening? Thanks!

Upvotes: 1

Views: 86

Answers (2)

Jack Patoliya
Jack Patoliya

Reputation: 517

Please apply constraint TOP-RIGHT-LEFT-BOTTOM

Upvotes: 0

Crazyrems
Crazyrems

Reputation: 2601

Are you sure you are using autolayout with well setted constraints ? It seems your view controller is 300x300 pixels as in the any Size Class definition.

Try to look at a button in your bottom right xib editor that looks like this
|-□-|

If you don't set any constraint, your view is binded to no layout and will not adapt at all.

You have to set constraints to define position (x, y) and size (width, height) with your constraints in order to make it adapting to your view controller without ambiguity.
In your example, you just have to set every border of your view (top, left, right bottom) to match the borders of its superview.

Upvotes: 0

Related Questions