0

I have created an interface for my app in Storyboard under the Any x Any layout setup, when I run my app the layout is still sized for the square Any x Any and not the phone screen. I want the app to adjust to all sizes and not use a set layout for set screen sizes. How can I do this?

Here are pictures to show my design, and the outcome of running the app.

Storyboard View

Simulator View

The table view is also cut off here

4 Answers 4

0

If your ViewController is subclass of UIViewController then add leading, trailing ,top and bottom constraints to UITableView, and contains to your custom navigation bar. or If its subclass of UITableViewController. No need to add any constraints. Just embed your TableViewController into NavigationController.

Hope this will help you

Sign up to request clarification or add additional context in comments.

Comments

0

what exactly are you trying to achieve? Your tableview to be entirely on the screen, so not scrollable?

If so, then you should override the layout of your tableview and its corresponding cells. As those cells (and the number of them) define the height of your tableview.

Comments

0

From what I can see it appears that you have manually added a UINavigationBar. I personally find it much easier to embed your view controller into a navigation controller. This will provide you with a navigation bar that will automatically resize depending on the hardware, or size class, of the device. To embed it go to: Editor -> Embed in -> Navigation Controller.

Your TableView seems to be fully in the screen as well? If you have layout issues with your cells not adjusting then I will be more than happy to help you once you clarify what is not quite right.

Hope this helps.

Comments

0

Yep. Been there, done that. Just because something is centered in the Any x Any view in interface builder does not mean it will also be centered e.g. in an iPhone simulator. You always need to make your layout choices explicit with constraints, i.e. in the this case add a "center horizontally in superview" constraint or align the right and left edge with the superview (I really would need to know more about your view controller in interface builder to tell you exactly).

Are you familiar with constraints or should I add some more detail on how to solve this?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.