Xcode 6 Storyboard the wrong size?

2019-01-20 21:07发布

Built a new project from scratch in Swift in Xcode 6 (Beta 1) and have seen some strange behaviour with Storyboards and the output that I am viewing.

I have built a simple interface (as shown below) - with properties of View Controller included. When I run this in the simulator I would expect 'Hello, World' to be central in the user interface - however it seems that this 'Square' is simply being fit into the iPhone screen and thus the wrong view is being shown (see below).

My question is: has anyone else seen this behaviour and how did they fix it?

Thanks!

View from the Storyboard Editor

Attributes Inspector

Size Inspector

Simulator Output

9条回答
迷人小祖宗
2楼-- · 2019-01-20 22:03

For anyone using XCode 7, it's very easy to design for a specific device size (instead of the default square-ish canvas).

In Interface Builder, select your ViewController or Scene from the left menu. Then under Show the Attributes Inspector, go to the Simulated Metrics, and pick the desired Size from the dropdown menu.

查看更多
劫难
3楼-- · 2019-01-20 22:07

In Storyboard, select your ViewController and go to Atribute Inspector. At the very top, under Simulated Metrics you have Size and Orientation properties which are set to Inferred. Change them to desired values.

In order for an application to display properly on another screen size, you also have to setup constraints, as described by Can Poyrazoğlu in the first post.

查看更多
叛逆
4楼-- · 2019-01-20 22:07

You shall probably use the "Resolve Auto Layout Issues" (bottom right - triangle icon in the storyboard view) to add/reset to suggested constraints (Xcode 6.0.1).

查看更多
登录 后发表回答