ios 如何调整 iPhone/iPad 模拟器的大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6140051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:06:05  来源:igfitidea点击:

How to resize the iPhone/iPad Simulator?

iosxcodeios-simulatorxcode9simulator

提问by Hedge

The iPad-simulator is really small (like one third the size of the real iPadscreen) on my 23" Full-HD screen (and also on the 15" MacBook Pro).

iPad 模拟器iPad在我的 23 英寸全高清屏幕上(以及在15" MacBook Pro.

Is there a way to resize it?

有没有办法调整它的大小?

I know it must maintain size and dpi-ratio to prevent sub-pixels, but I can hardly see anything withoout a magnifier.

我知道它必须保持大小和 dpi 比率以防止出现亚像素,但没有放大镜我几乎看不到任何东西。

回答by Erik B

?+1for 100%
?+2for 75%
?+3for 50%

?+ 1100%
?+ 275%
?+ 350%

回答by Krunal

It's more flexible with Xcode 9-Simulator.Just pick & drag any corner of simulator to resize it and set it according to your requirement.

使用 Xcode 9-Simulator 更加灵活。只需选择并拖动模拟器的任何角落即可调整其大小并根据您的要求进行设置。

Look at this snapshot:

看看这个快照:

enter image description here

在此处输入图片说明



Note: With Xcode 9.1+, Simulator scale options are changed.

注意:在 Xcode 9.1+ 中,模拟器缩放选项已更改。



Keyboard short-keys:
According to Xcode 9.1+



键盘
快捷: 根据 Xcode 9.1+

Physical Size       ? 1      command + 1
Pixel Accurate      ? 2      command + 2


According to Xcode 9


根据 Xcode 9

50% Scale           ? 1      command + 1
100% Scale          ? 2      command + 2
200% Scale          ? 3      command + 3


Simulator scale options from Xcode Menu:

Xcode 菜单中的模拟器缩放选项

Xcode 9.1+:
Menubar ? Window ? "Here, options available change simulator scale" (Physical Size& Pixel Accurate)

Xcode 9.1+:
菜单栏?窗户 ?“在这里,可用选项更改模拟器比例”(物理尺寸像素准确度

Pixel Accurate: Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled.

像素准确:将模拟器调整为实际(物理)设备的像素,如果您的 mac 系统显示屏幕尺寸(像素)支持那么高的分辨率,否则此选项将保持禁用状态。

enter image description here

在此处输入图片说明

Xcode 9.0
Menubar ? Window ? Scale ? "Here, options available change simulator scale"

Xcode 9.0
菜单栏?窗户 ?规模 ?“在这里,可用选项更改模拟器比例”

enter image description here

在此处输入图片说明



Using Terminal Command
Follow these steps to scale simulator using terminal commands

使用终端命令
按照以下步骤使用终端命令扩展模拟器

  1. Close/Quit simulator. (if open)
  2. Open Terminalapp (using Spotlight search, Press ? + SPACEto open spotlight search)
  3. Copy following text and paste it next to terminal cursor.
  1. 关闭/退出模拟器。(如果打开)
  2. 打开Terminal应用程序(使用 Spotlight 搜索,按? + SPACE打开 Spotlight 搜索)
  3. 复制以下文本并将其粘贴到终端光标旁边。

defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"

defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"

  1. Open 'Simulator' (Run your iOS project using Xcode).
  1. 打开“模拟器”(使用 Xcode 运行您的 iOS 项目)。

You will find simulator scale update.

您会发现模拟器比例更新。



回答by Jayprakash Dubey

Xcode 9.x :

Xcode 9.x:

  1. Select Simulator
  2. Goto Windowtab
  3. Select Physical Sizeoption (cmd + 1)
  1. 选择 Simulator
  2. 转到Window选项卡
  3. 选择Physical Size选项 ( cmd + 1)

Screenshot 1

截图 1

Now if this dosen't make size as per your interest then follow below steps :

现在,如果这不符合您的兴趣,请按照以下步骤操作:

  1. Select Simulator
  2. Goto edge of simulator. This will convert your cursor to resize option (Bidirectional arrow).
  3. Now using this resize option you can change the size as you desire.
  1. 选择 Simulator
  2. 转到edge of simulator。这会将您的光标转换为调整大小选项(双向箭头)。
  3. 现在使用此调整大小选项,您可以change the size as you desire

Xcode 8 or below :

Xcode 8 或以下:

https://stackoverflow.com/a/30588057/1753005

https://stackoverflow.com/a/30588057/1753005

回答by Arshin

For Xcode 9, Beta 6: Deselect "Show Device Bezels" under Window menu. Then Cmd + 2 should scale to 100% (Window Menu -> Scale -> 100%).

对于 Xcode 9、Beta 6:取消选择“窗口”菜单下的“显示设备边框”。然后 Cmd + 2 应该缩放到 100%(窗口菜单 -> 缩放 -> 100%)。

Tested using 15" Macbook Pro (2017 Model).

使用 15" Macbook Pro(2017 型号)测试。

回答by Austin France

For XCode 10 I ended up having to do

对于 XCode 10 我最终不得不做

defaults delete ~/Library/Preferences/com.apple.iphonesimulator DevicePreferences

I just could not find any other way to reset zoom level. Even using Window->Zoom to toggle zoom, would not restore back to 100% (2042x2732 iPad 12.9-inch).

我只是找不到任何其他方法来重置缩放级别。即使使用 Window->Zoom 切换缩放,也不会恢复到 100%(2042x2732 iPad 12.9 英寸)。

Deleting device preferences allowed the simulator to open at full resolution again, so I could take the screen shots required for app store submission.

删除设备首选项允许模拟器再次以全分辨率打开,因此我可以拍摄应用商店提交所需的屏幕截图。

The Physical Sizeand Pixel Accurateoptions remain greyed out.

Physical SizePixel Accurate选项保持灰色。

回答by Mani

But in the smaller screens(MacBook Pro 15-Inch), I can't scale it more than the screen size

但是在较小的屏幕(MacBook Pro 15 英寸)中,我无法将其缩放到超过屏幕尺寸

There are little utilities that allows you to set your display resolution much higher as the System Preference may offer you.

有一些实用程序可以让您将显示分辨率设置得更高,因为系统偏好设置可能会为您提供。

For instance, if u need 12.9-Inch Retina Display screenshot with a resolution of 2048 x 2732 pixels for portrait. I simply use one of these utilities (e.g.: Display Menu from the App Store) to set my Macbook Pro 2017 Retina display to 3360x2100.

例如,如果您需要分辨率为 2048 x 2732 像素的 12.9 英寸 Retina Display 屏幕截图作为肖像。我只是使用这些实用程序之一(例如:App Store 中的显示菜单)将我的 Macbook Pro 2017 Retina 显示器设置为 3360x2100。

After that I start the Xcode Simulator with a 12,9" iPad Retina and resize the Simulator to the maximum of the screen. As a result, I get exactly 2048 x 2732 which is ready to upload to the App Store.

之后,我使用 12,9" iPad Retina 启动 Xcode Simulator 并将模拟器的大小调整到屏幕的最大值。结果,我得到了 2048 x 2732,可以上传到 App Store。

enter image description here

在此处输入图片说明

Hope that is useful for someone.

希望这对某人有用。

回答by Naveen George Thoppan

Xcode 9.x

Xcode 9.x

You can resize any simulator in the same way of expanding any windows in Mac. Move the mouse over the corner of any simulators and the pointer changes. Click and drag to expand/shrink the simulator. Verified using Xcode 9.2

您可以按照在 Mac 中扩展任何窗口的相同方式调整任何模拟器的大小。将鼠标移到任何模拟器的角落,指针就会发生变化。单击并拖动以扩展/缩小模拟器。使用 Xcode 9.2 验证

回答by gypsyDev

For Xcode 9.4 this is the only thing which worked: -Uncheck "Optimize rendering for window size" in the "Debug" menu. -take a *screen shot using "?s" or "New screen shot" from the file maenu.

对于 Xcode 9.4,这是唯一有效的方法: - 在“调试”菜单中取消选中“针对窗口大小优化渲染”。- 使用文件 maenu 中的“?s”或“新屏幕截图”进行*屏幕截图。

*note - it doesn't matter what size the simulator is, the screen shot will be the correct size for uploading to iTunes Connect

*注意 - 模拟器的大小无关紧要,屏幕截图将是上传到 iTunes Connect 的正确大小

回答by Kent Allen Sison

You can do this:

你可以这样做:

Window > Uncheck Show Device Bezels

窗口 > 取消选中显示设备边框

After that, you can customize your simulator's width and length. If you're satisfied in its size, you can check again the 'Show Device Bezels'

之后,您可以自定义模拟器的宽度和长度。如果您对它的大小感到满意,您可以再次检查“显示设备边框”

回答by ioopl

CMD + Space

CMD + 空格

Search for System Preferences

搜索系统偏好设置

Then Select Accessibility

然后选择辅助功能

Choose Zoom

选择缩放

CheckUse scroll gesture with modifier keys to zoom:

选中使用带有修饰键的滚动手势进行缩放:

Select CMD Key or Option (whichever you prefer)

选择 CMD 键或选项(无论你喜欢哪个)

Thats it:

就是这样:

Now on your trackpad do CMD + 2 finger UP and Downto Scroll to Zoom inor Zoom out

现在在您的触控板上执行 CMD + 2 指上下滚动以放大缩小

enter image description here

在此处输入图片说明