Dancer
Dancer

Reputation: 17651

IOS7 - AutoLayout Screen Width

I'm new to AutoLayout - My Screen structure is as follows in this image -

enter image description here

Basically all looks fine when portrait - if I spin the screen to landscape the header centres but the screen sticks to the portrait width - as follows -

enter image description here

I've been playing around with constraints for over an hour but cant make it stretch to full width - any idea what I'm doing wrong!?

Upvotes: 0

Views: 281

Answers (2)

simonnickel
simonnickel

Reputation: 557

When using the buttons on the bottom of the storyboard to position a view, it often positions them relative to an other view (looks like the login-view is centered to the blurred image, but we cant see your other constraints).

Therefore you should ctrl-click and drag the view from the left panel to the view you want to position him relative to (in this case the view on the highest level).

You also should click on the little orange arrow to see all the constraints Xcode can not resolve properly.

Upvotes: 1

MuhammadBassio
MuhammadBassio

Reputation: 1570

I assume that Image View - blurredBG is the BG image, and View below it is the login view.

In interface builder, tap the ruler icon in the right pannel & choose center position for your login view (i.e. not starting point as x & y).

you can do the same for your blurredBG but its size should be 1024px * 1024px.

you can also re-position both of them in -(void)viewWillLayoutSubviews

Hope it helps :)

Upvotes: 0

Related Questions