iOS - 更改Xcode模拟器屏幕大小[重复]

时间:2023-02-08 15:59:57

This question already has an answer here:

这个问题在这里已有答案:

I'm using Xcode 7 and am having trouble with matching the simulator to the view displayed in Xcode. The simulator screen seems to "zoomed in" too much and as a result, some of the objects located near the edges of the view are not displayed when running the simulator.

我正在使用Xcode 7,并且在将模拟器与Xcode中显示的视图匹配时遇到问题。模拟器屏幕似乎“放大”太多,因此,运行模拟器时,不会显示位于视图边缘附近的某些对象。

Deployment target: 9.0
Devices: Universal
Target scheme: iPhone 6

I did some reading about Xcode's autolayout but can't seem to figure out the settings that need to be changed. (How can to fit simulator according to my device screen?)

我做了一些关于Xcode自动布局的阅读,但似乎无法弄清楚需要更改的设置。 (如何根据我的设备屏幕安装模拟器?)

2 个解决方案

#1


5  

If simulator is 'zoomed in' you can scale it by 'window -> scale' to 75%, 50% or lower. You can also use command+1,command+2,...command+4 shortcut in your keyboard while simulator selected. If you already done this, You can change size of view controller in Attribute Inspector. To do this, you need to select view controller in storyboard file -> select Attribute Inspector in Utilities -> In Simulated Metrics, change 'Size' from 'Inferred' to 'iPad full screen' or 'iPhone 5.5-inch' (In your case, use 'iPhone 4.7-inch' for iPhone 6). This will display view controller to same size as your simulator/device. You can also change the orientation right below size. Yes, By doing this you will set interface for specific orientation/sizes. You need to learn Auto Layout to set objects at right locations in different devices/screen size.

如果模拟器“放大”,您可以通过“窗口 - >比例”将其缩放到75%,50%或更低。您还可以在选择模拟器时使用键盘上的命令+ 1,命令+ 2,...命令+4快捷键。如果您已完成此操作,则可以在“属性”检查器中更改视图控制器的大小。为此,您需要在故事板文件中选择视图控制器 - >在“实用程序”中选择“属性”检查器 - >在“模拟度量标准”中,将“大小”从“推断”更改为“iPad全屏”或“iPhone 5.5英寸”(在您的案例,iPhone 6使用'iPhone 4.7英寸')。这将显示视图控制器与模拟器/设备相同的大小。您还可以更改尺寸以下的方向。是的,通过这样做,您将为特定方向/尺寸设置界面。您需要学习自动布局,以便在不同设备/屏幕尺寸的正确位置设置对象。

#2


1  

You can't have 1:1 ratio. Read about screen resolutions.

你不能有1:1的比例。了解屏幕分辨率。

However you can scale it from the iOS Simulator > Window > Scale menu.

但是,您可以从iOS模拟器>窗口>缩放菜单缩放它。

#1


5  

If simulator is 'zoomed in' you can scale it by 'window -> scale' to 75%, 50% or lower. You can also use command+1,command+2,...command+4 shortcut in your keyboard while simulator selected. If you already done this, You can change size of view controller in Attribute Inspector. To do this, you need to select view controller in storyboard file -> select Attribute Inspector in Utilities -> In Simulated Metrics, change 'Size' from 'Inferred' to 'iPad full screen' or 'iPhone 5.5-inch' (In your case, use 'iPhone 4.7-inch' for iPhone 6). This will display view controller to same size as your simulator/device. You can also change the orientation right below size. Yes, By doing this you will set interface for specific orientation/sizes. You need to learn Auto Layout to set objects at right locations in different devices/screen size.

如果模拟器“放大”,您可以通过“窗口 - >比例”将其缩放到75%,50%或更低。您还可以在选择模拟器时使用键盘上的命令+ 1,命令+ 2,...命令+4快捷键。如果您已完成此操作,则可以在“属性”检查器中更改视图控制器的大小。为此,您需要在故事板文件中选择视图控制器 - >在“实用程序”中选择“属性”检查器 - >在“模拟度量标准”中,将“大小”从“推断”更改为“iPad全屏”或“iPhone 5.5英寸”(在您的案例,iPhone 6使用'iPhone 4.7英寸')。这将显示视图控制器与模拟器/设备相同的大小。您还可以更改尺寸以下的方向。是的,通过这样做,您将为特定方向/尺寸设置界面。您需要学习自动布局,以便在不同设备/屏幕尺寸的正确位置设置对象。

#2


1  

You can't have 1:1 ratio. Read about screen resolutions.

你不能有1:1的比例。了解屏幕分辨率。

However you can scale it from the iOS Simulator > Window > Scale menu.

但是,您可以从iOS模拟器>窗口>缩放菜单缩放它。