ios 调整 Xcode iPhone 模拟器比例和大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18606926/
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
Adjusting the Xcode iPhone simulator scale and size
提问by cdub
Is there anyway to make the iOS simulator for iPhone 5 in Xcode, be the actual size of the iPhone 5. I'm getting a huge display and things seemed to be scaled.
有没有办法在 Xcode 中为 iPhone 5 制作 iOS 模拟器,成为 iPhone 5 的实际尺寸。我得到了一个巨大的显示器,而且东西似乎被缩放了。
回答by Krunal
With Xcode 9 - Simulator, you can pick & drag any corner of simulator to resize it and set according to your requirement.
使用 Xcode 9 - Simulator,您可以选择并拖动模拟器的任何角落以调整其大小并根据您的要求进行设置。
Look at this snapshot.
看看这张截图。
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 系统显示屏幕尺寸(像素)支持那么高的分辨率,否则此选项将保持禁用状态。
Tip: rotate simulator (? + ← or ? + → ), if Pixel Accurate is disabled. It may be enabled (if it fits to screen) in landscape.
提示:如果 Pixel Accurate 被禁用,则旋转模拟器(? + ← 或? + → )。它可以在横向启用(如果它适合屏幕)。
Xcode 9.0
Menubar ? Window ? Scale ? "Here, options available change simulator scale"
Xcode 9.0
菜单栏?窗户 ?规模 ?“在这里,可用选项更改模拟器比例”
Tip: How do you get screen shot with 100% (a scale with actual device size) that can be uploaded on AppStore?
提示:如何获得可以上传到 AppStore 的 100%(与实际设备大小的比例)的屏幕截图?
Disable 'Optimize Rendering for Window scale' from Debug
menu, before you take a screen shot (See here: How to take screenshots in the iOS simulator)
Debug
在您拍摄屏幕截图之前,从菜单中禁用“优化窗口缩放的渲染” (请参阅此处:如何在 iOS 模拟器中拍摄屏幕截图)
There is an option
有一个选项
Menubar ? Debug ? Disable "Optimize Rendering for Window scale"
菜单栏 ?调试?禁用“优化窗口比例渲染”
Here is Apple's document: Resize a simulator window
这是 Apple 的文档:调整模拟器窗口的大小
回答by Desdenova
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 Simulator > Window > Scale
菜单中缩放它。
Good Luck.
祝你好运。
回答by Kalpesh
Check this Image… You can change your simulator size from here
检查此图像...您可以从此处更改模拟器大小
or press CMD+1, CMD+2or CMD+3
或按CMD+ 1、CMD+2或CMD+3
回答by Dren
You can set any scale you wish. It`s became actual after 6+ simulator been presented
您可以设置任何您想要的比例。6+模拟器出现后变成实际
To obtain it follow next easy steps:
要获得它,请按照以下简单步骤操作:
- quit simulator if open
- open terminal (from spotlight for example)
- paste next text to terminal and press enter
- 如果打开就退出模拟器
- 打开终端(例如来自聚光灯)
- 将下一个文本粘贴到终端并按 Enter
defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.4"
默认写 ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.4"
You can try any scales changing 0.4 to desired value.
您可以尝试将 0.4 更改为所需值的任何比例。
To reset this custom scale, just apply any standard scale from simulator menu in way described above.
要重置此自定义比例,只需按照上述方式从模拟器菜单应用任何标准比例。
回答by hybridcattt
You are seeing it huge because of your screen resolution. iPhone 5's display is 640x1136. Current resolution of your display can be found in System preferences, and it's height on notebooks is usually around 1000 px (give or take). So surely, the simulator in 1:1 scale will take all the height of the screen and even more.
由于您的屏幕分辨率,您看到它很大。iPhone 5 的显示屏为 640x1136。您的显示器的当前分辨率可以在系统首选项中找到,它在笔记本电脑上的高度通常约为 1000 像素(给予或接受)。可以肯定的是,1:1 比例的模拟器将占据屏幕的所有高度,甚至更多。
The iPhone simulator has three scales, 100%, 75% and 50%. You can change between them any time by pressing CMD+1, CMD+2, CMD+3 or from Window menu.
iPhone 模拟器有 100%、75% 和 50% 三个等级。您可以通过按 CMD+1、CMD+2、CMD+3 或从窗口菜单随时在它们之间切换。
Note that 100%-mode is very helpful for graphic checks, on full resolution you will be able to notice all defects or measure point size of the elements.
请注意,100% 模式对于图形检查非常有帮助,在全分辨率下,您将能够注意到所有缺陷或测量元素的点大小。
回答by Dipen Panchasara
Specific to XCode 9.1:
You can refere to @Krunal's answer above or follow below steps
特定于XCode 9.1:
您可以参考上面@Krunal 的回答或按照以下步骤操作
its bit tricky to adjust Simulator size.
调整模拟器大小有点棘手。
If you want to zoom your simulator screen follow below steps :
如果要缩放模拟器屏幕,请按照以下步骤操作:
Goto Window->Uncheck Show Device Bezels
Goto Window->Uncheck Show Device Bezels
Goto Window->select zoom
Goto Window->select zoom
after doing this you can resize your simulator by dragging edges of simulator.
完成此操作后,您可以通过拖动模拟器的边缘来调整模拟器的大小。
Pixel Accurate: Its to display your simulator in same size as Physical device pixels, if your screen size doesn't have enough resolution to cover dimension it would not enable Pixel Accurate
option.
像素准确:它以与物理设备像素相同的大小显示您的模拟器,如果您的屏幕尺寸没有足够的分辨率来覆盖尺寸,则不会启用Pixel Accurate
选项。
Alternate is change simulator to landscape mode by clicking ? + → ,then you could click ? + 2 to select Pixel Accurate option (make sure you have disable Show Device Bezels
to reduce size.
或者通过单击将模拟器更改为横向模式?+ → ,然后你可以点击?+ 2 选择 Pixel Accurate 选项(确保您已禁用Show Device Bezels
以减小尺寸。
回答by kumar123
However iOS Simulator->HardWare->Device
menu.
然而iOS Simulator->HardWare->Device
菜单。
回答by TwoStraws
In Xcode 9 there is a new "Actual Size" option. In the Simulator to the Window menu and choose Scale > Actual Size to trigger it. This takes into account your current screen resolution to ensure the on-screen device matches the physical dimensions of a real device.
在 Xcode 9 中有一个新的“实际大小”选项。在 Simulator 的 Window 菜单中选择 Scale > Actual Size 来触发它。这会考虑您当前的屏幕分辨率,以确保屏幕设备与真实设备的物理尺寸相匹配。