iPad app not scaling properly

812 views Asked by At

I am new to iOS development. Coming from Visual Studio and C#, XCode is very confusing to use.

I followed Ray Wenderlich's tutorial here to make my first app. The app works fine but the app does not scale to the full screen even though I've designed the UI such in XCode Storyboard. It currently looks like this:

iPad app not aligned to full screen.

As you can notice, the alignment is not proper. In XCode though, I've placed the controls properly:

XCode Storyboard view

How do I fix this?

Note: I'm testing in an iPad Air.

1

There are 1 answers

2
Mike Gledhill On BEST ANSWER

As a VS developer, I can completely relate with you.

In the Xcode world, you must use constraints, to explain to the iOS device how to position your controls, relative to the size of the screen.

I'd recommend going back to RayWenderlich and have a read of this: AutoLayout

It will drive you mad... but once you understand it, it'll allow you to do your control positioning without writing any code.

Just remember that you need to add enough constraints to each control so XCode can exactly work out the width & height, x-pos and y-pos.

(It takes some practice. And patience. And swearing. Mostly swearing.)