简体   繁体   English

如何在iPhone 6 / 6s或iPhone 6 + / 6s +的iOS模拟器中打开显示缩放

[英]How to turn on Display Zoom in iOS Simulator for iPhone 6/6s or iPhone 6+/6s+

Is it possible to turn on Display Zoom in the Xcode iOS Simulator for iPhone 6/6s or iPhone 6+/6s+ so that it is possible to test and optimize using that mode? 是否可以在适用于iPhone 6 / 6s或iPhone 6 + / 6s +的Xcode iOS模拟器中打开“显示缩放”功能,以便可以使用该模式进行测试和优化? On an actual device Display Zoom can be turned on in Settings > Display & Brightness however that option isn't listed in the iOS Simulator settings. 在实际设备上,可以在“设置”>“显示和亮度”中打开“显示缩放”,但是iOS Simulator设置中未列出该选项。

Display Zoom is not available as an option in the current Xcode 7 iOS simulator settings. 在当前的Xcode 7 iOS模拟器设置中,“显示缩放”不是一个选项。 However , it is actually possible to 'simulate' Display Zoom when running your app in the simulator. 然而 ,它实际上有可能在模拟器中运行你的应用程序时,“模拟”显示器缩放。

Background 背景

When building a typical project for iPhone, you generally specify a LaunchScreen.storyboard file and/or launch images in Images.xcassets for the iPhone 4/4s ( 2x ), iPhone 5/5s ( Retina 4 ), iPhone 6/6s ( Retina HD 4.7 ) and iPhone 6+/6s+ ( Retina HD 5.5 ) and set those details in the project's settings. 在为iPhone构建典型项目时,通常Images.xcassets为iPhone 4 / 4s( 2x ),iPhone 5 / 5s( Retina 4 ),iPhone 6 / 6s( Retina HD 4.7 )指定LaunchScreen.storyboard文件和/或在Images.xcassets启动图像。 Retina HD 4.7 )和iPhone 6 + / 6s +( Retina HD 5.5 ),并在项目设置中设置这些详细信息。 (See image below.) (请参见下图。)

When Display Zoom is turned 'on' for a iPhone 6/6s device, the device runs the app as if it was running on an iPhone 5/5s sized screen, upscaling the app x1.172 to fit the iPhone 6/6s display. 如果为iPhone 6 / 6s设备打开了“显示缩放”功能,则该设备会像在iPhone 5 / 5s大小的屏幕上一样运行该应用程序,从而将应用程序x1.172放大以适合iPhone 6 / 6s的显示。 (Similarly, when Display Zoom is turned 'on' for a iPhone 6+/6+s device, the device runs the app as if it was running on an iPhone 6/6s sized screen, upscaling the app to fit the iPhone 6+/6+s display.) (类似地,当为iPhone 6 + / 6 + s设备打开“显示缩放”功能时,该设备会像在iPhone 6 / 6s尺寸的屏幕上一样运行应用程序,从而扩大应用程序以适合iPhone 6+ / 6 + s显示。)

Note - The following instructions require the removal of some launch screen image files. 注意-以下说明要求删除一些启动屏幕图像文件。 You might wish to attempt these changes on a duplicate of your Xcode project. 您可能希望对Xcode项目的副本进行这些更改。

Simulating Display Zoom on the iOS Simulator 在iOS模拟器上模拟显示缩放

To simulate Display Zoom for example using the iPhone 6 simulator in Xcode: 例如,使用Xcode中的iPhone 6模拟器来模拟Display Zoom:

1 - Remove the LaunchScreen.storyboard file. 1-删除LaunchScreen.storyboard文件。

2 - Remove both the Retina HD 4.7 and Retina HD 5.5 launch images in Images.xcassets . 2-删除Images.xcassetsRetina HD 4.7Retina HD 5.5启动图像。 (Make sure to keep the Retina 4 launch image.) (请确保保留Retina 4启动图像。)

3 - Remove the reference to the 'Launch Screen File' in your Xcode project's settings, under 'General', under 'App Icons and Launch Images'. 3-在Xcode项目设置的“常规”下,“应用程序图标和启动图像”下,删除对“启动屏幕文件”的引用。

4 - Select the iPhone 6/6s simulator, and then 'Run' your app. 4-选择iPhone 6 / 6s模拟器,然后“运行”您的应用程序。

Running your app 运行你的应用

When the simulator runs your app, it will detect that no launch images are present for iPhone 6/6s, so it will presume it must be an iPhone 5/5s app and launch it into the simulator upsampling a iPhone 5/5s sized screen to fit the iPhone 6/6s screen, just as the Display Zoom setting would display it! 当模拟器运行您的应用程序时,它将检测到iPhone 6 / 6s没有启动图像,因此它将假定它必须是iPhone 5 / 5s应用程序,然后将其启动到模拟器中,以对iPhone 5 / 5s大小的屏幕进行升采样。适合iPhone 6 / 6s屏幕,就像“显示缩放”设置将其显示一样!

在此处输入图片说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM