无法在 iOS 模拟器中缩放设备窗口
在我工作时使用的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
现在使用 Xcode 9+ 模拟器更加灵活。您可以选择&拖动模拟器的任意角来调整其大小并根据您的要求进行设置。
看看这张快照。
注意:在 Xcode 9.1+ 中,模拟器缩放选项已更改。
还有其他几种方法可以扩展模拟器。
键盘快捷键:
根据 Xcode 9.1+
根据 Xcode 9
模拟器比例选项菜单:
Xcode 9.1+:
像素精确: 将模拟器大小调整为实际(物理)设备的像素,如果您的 Mac 系统显示屏幕尺寸(像素)支持那么高的分辨率,否则此选项将保持禁用状态。
Xcode 9.0:
使用终端命令
按照以下步骤使用终端命令
Terminal
应用程序(使用 Spotlight 搜索,按⌘ + SPACE
打开 Spotlight 搜索)默认写入 ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"
您会发现模拟器规模更新。
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.
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+
According to Xcode 9
Simulator scale options Menu:
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.
Xcode 9.0:
Using Terminal Command
Follow these steps to scale simulator using terminal commands
Terminal
app (using Spotlight search, Press⌘ + SPACE
to open spotlight search)defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"
You will find simulator scale update.
仅当您的屏幕不够大,无法以 100% 显示窗口时,这些选项才会出现。
The options will only be there if your screen is not large enough to show the window at 100%.
对于 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).
我通过将 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!.
我可以确认 @Abdulaziz Noor 更改 Mac 显示器分辨率的方法有效。
我采取的步骤:
I can confirm that @Abdulaziz Noor method of changing the resolution of your mac display works.
Steps I took:
如果您只想要 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.
即使在 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.