无法在 iOS 模拟器中缩放设备窗口

发布于 2024-10-19 13:45:11 字数 129 浏览 10 评论 0原文

在我工作时使用的 24" iMac 上,我无法缩放 iOS 模拟器的窗口。100% 和 50% 菜单项呈灰色(并且键盘快捷键也不起作用。)

在我家里的 Mac Mini 上,它是好吧,我到处寻找有类似问题的人,但找不到任何想法。

On the 24" iMac I'm using at work I cannot scale the iOS Simulator's window. The 100% and 50% menu entries are greyed out (and the keyboard shortcuts don't work either.)

On my Mac Mini at home, it's fine. I've searched high and low for someone with a similar problem, and can't find anything logged. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

猛虎独行 2024-10-26 13:45:11

现在使用 Xcode 9+ 模拟器更加灵活。您可以选择&拖动模拟器的任意角来调整其大小并根据您的要求进行设置。

看看这张快照。

在此处输入图像描述

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

还有其他几种方法可以扩展模拟器。

键盘快捷键

根据 Xcode 9.1+

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

根据 Xcode 9

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

模拟器比例选项菜单

Xcode 9.1+:

菜单栏 ▶ 窗口 ▶ “此处,可用于更改模拟器比例的选项”(物理尺寸和像素精确度)

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

在此处输入图像描述

Xcode 9.0:

菜单栏 ▶ 窗口 ▶ 比例 ▶ “此处,可用于更改模拟器比例的选项”

在此处输入图像描述

使用终端命令

按照以下步骤使用终端命令

  1. 关闭/退出模拟器来扩展模拟器。 (如果打开)
  2. 打开 Terminal 应用程序(使用 Spotlight 搜索,按 ⌘ + SPACE 打开 Spotlight 搜索)
  3. 复制以下文本并将其粘贴到终端光标旁边。

默认写入 ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"

  1. 打开“模拟器”(使用 Xcode 运行您的 iOS 项目)。

您会发现模拟器规模更新。

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

Look at this snapshot.

enter image description here

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

There are several other ways also, to scale your simulator.

Keyboard short-keys:

According to Xcode 9.1+

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

According to Xcode 9

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

Simulator scale options Menu:

Xcode 9.1+:

Menubar ▶ Window ▶ "Here, options available to change simulator scale" (Physical Size & Pixel Accurate)

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.

enter image description here

Xcode 9.0:

Menubar ▶ Window ▶ Scale ▶ "Here, options available to change simulator scale"

enter image description here

Using Terminal Command

Follow these steps to scale simulator using terminal commands

  1. Close/Quit simulator. (if open)
  2. Open Terminal app (using Spotlight search, Press ⌘ + SPACE to open spotlight search)
  3. Copy following text and paste it next to terminal cursor.

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

  1. Open 'Simulator' (Run your iOS project using Xcode).

You will find simulator scale update.

秋意浓 2024-10-26 13:45:11

仅当您的屏幕不够大,无法以 100% 显示窗口时,这些选项才会出现。

The options will only be there if your screen is not large enough to show the window at 100%.

梨涡少年 2024-10-26 13:45:11

对于 Xcode 9,我们会检测您的屏幕尺寸。如果它不够大,无法显示窗口,我们将禁用相关的缩放选项。

正如 Krunal 指出的那样,您现在可以拖动将窗口缩放到您想要的任意大小,因此这应该不是问题。 (在以前的版本中,您只能从预定义的尺寸中进行选择;窗口本身无法调整大小)。

For Xcode 9, we detect the size of your screen. If it isn't large enough to display the window we disable the relevant scaling option.

As Krunal points out you can now drag to scale the window to whatever arbitrary size you want so this shouldn't be a problem. (In previous releases you could only pick from pre-defined sizes; the window itself was not resizable).

迎风吟唱 2024-10-26 13:45:11

我通过将 Macbook Pro 屏幕的分辨率更改为最大支持值解决了这个问题,并通过拖动增加模拟器的大小,它的工作!
我现在可以附上 iPad 屏幕截图。感谢苹果,一切都像往常一样简单!

I solved this problem by changing the resolution of my Macbook Pro screen to biggest supported value, And increase the size of the simulator by drag and it's work!
I can now attach iPad screenshot. Thanks Apple it's totally easy like always!.

请你别敷衍 2024-10-26 13:45:11

我可以确认 @Abdulaziz Noor 更改 Mac 显示器分辨率的方法有效。

我采取的步骤:

System Preferences -> Displays -> Display -> Scaled -> More Space 

I can confirm that @Abdulaziz Noor method of changing the resolution of your mac display works.

Steps I took:

System Preferences -> Displays -> Display -> Scaled -> More Space 
自找没趣 2024-10-26 13:45:11

如果您只想要 100% 的屏幕截图,您可以将其拖动到至少与 100% 一样大的屏幕截图,屏幕截图将与 100% 的屏幕截图相同。

If you are just wanting a 100% screen shot you can just drag it to be anything at least as big as 100% and the screenshot will be the same as a 100% screenshot.

影子是时光的心 2024-10-26 13:45:11

即使在 xcode9 中,如果你的屏幕无法适应,它也不会让你将缩放设置为 100%,但你可以作弊.. ..只需选择横向方向,并且设备的宽度是否适合屏幕的高度,您可以选择 100%,然后旋转设备,即使它不完全适合屏幕。

Even in xcode9 it won't let you set the scaling to 100% if your screen can't accommodate that, but you can cheat.. ..just choose landscape orientation and if the width of the device will fit the height of the screen, you can choose 100%, and then rotate the device even if it won't all fit on screen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文