简体   繁体   中英

Can't scale device window in iOS Simulator

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?

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+

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.

在此输入图像描述


Xcode 9.0:

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

在此输入图像描述



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.

如果您的屏幕不够大,无法将窗口显示为100%,则选项将仅存在。

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).

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!.

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 

如果你只想要一个100%的屏幕截图,你可以将其拖动到至少100%的任何位置,截图将与100%截图相同。

即使在xcode9中,如果您的屏幕无法容纳,也不会让缩放设置为100%,但您可以作弊.. ..只选择横向,如果设备的宽度适合屏幕的高度,您可以选择100%,然后旋转设备,即使它不适合屏幕。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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