在 iOS 模拟器中截取屏幕截图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7092613/
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
Take screenshots in the iOS simulator
提问by Shreyash Mahajan
I want to take a screenshot of my iOS application when it is running in the simulator, and save the screenshot on my Mac. How can I do this?
我想在模拟器中运行时截取我的 iOS 应用程序的屏幕截图,并将屏幕截图保存在我的 Mac 上。我怎样才能做到这一点?
回答by Wojciech Rutkowski
It's just as simple as command+sor File
> Save Screen Shot
in iOS Simulator. It will appear on your desktop by default.
它就像iOS 模拟器中的command+s或File
>一样简单Save Screen Shot
。默认情况下,它会出现在您的桌面上。
回答by Krunal
An update with Xcode 11.4 simulator
Xcode 11.4 模拟器的更新
To capture a screen shot, click on 'Camera' icon/action button, on the top bar of simulator.
要捕获屏幕截图,请单击模拟器顶部栏上的“相机”图标/操作按钮。
OR
或者
Select Save Screen Shot
menu item, from File
menu.
Save Screen Shot
从File
菜单中选择菜单项。
File => Save Screen Shot
文件 => 保存屏幕截图
Use ? + Sto capture a screen shot.
(Use window + s, if you are using windows/non-apple keyboard).
使用? + S捕捉屏幕截图。
(window + s如果您使用的是 Windows/非苹果键盘,请使用 )。
See for more details: How to change simulator scale options with Xcode 9+.
有关更多详细信息,请参阅:如何使用 Xcode 9+ 更改模拟器比例选项。
Tip 1: How do you get screen shot with 100% (a scale with actual device size) that can be uploaded on AppStore?
提示 1:如何获得可以在 AppStore 上传的 100%(与实际设备大小的比例)的屏幕截图?
DisableOptimize Rendering for Window scale
from Debug
menu, before you take a screen shot.
在您拍摄屏幕截图之前,Optimize Rendering for Window scale
从Debug
菜单中禁用。
Here is an option
这是一个选项
Menubar ? Debug ? Disable "Optimize Rendering for Window scale"
菜单栏 ?调试?禁用“优化窗口比例渲染”
Tip 2: Where is screen shot saved (Default Path)? How to change default path?
提示 2:屏幕截图保存在哪里(默认路径)?如何更改默认路径?
Simulator saves screen shot file on (logged-in user's) desktop and it's default path.
Simulator 将屏幕截图文件保存在(登录用户的)桌面上,并且是默认路径。
To change default path (with Xcode 9+), press and hold ? Option(alt) button from keyboard, while you take a screen shot.
Or
Using Mac Keyboad: Press keys ? Option + ?+ sall together.
It will show to a dialog with file storage options and also allows to set/change default path.
要更改默认路径(使用 Xcode 9+),请按住? Option键盘上的 (alt) 按钮,同时进行屏幕截图。
或
使用 Mac 键盘:同时按下? Option + ?+键s。
它将显示一个带有文件存储选项的对话框,还允许设置/更改默认路径。
Tip 3: How to take a screen shot with Device Bezel?
技巧 3:如何使用 Device Bezel 截屏?
Enable Show Device Bezel
from Window
menu.
Show Device Bezel
从Window
菜单启用。
Here is an option
这是一个选项
Menubar ? Window ? Enable "Show Device Bezel"
菜单栏 ?窗户 ?启用“显示设备边框”
Now,
现在,
- Press ?+ shift+ 4+ Spacebar, all together in Mac Keyboard. (A window snap capture mode will become active)
- Select
Simulator
window/frame, that you want to capture. It will save screenshot with device bezel (with shadow effect in background) on (logged-in user's) desktop.
- 在 Mac 键盘中同时按下?+ shift+ 4+ Spacebar。(窗口捕捉模式将变为活动状态)
- 选择
Simulator
要捕获的窗口/框架。它将在(登录用户的)桌面上保存带有设备边框(背景中有阴影效果)的屏幕截图。
You can also remove the Simulator toolbar as described here.
您还可以按照此处所述删除模拟器工具栏。
回答by Mujah Maskey
on iOS Simulator,
在 iOS 模拟器上,
Press Command + control + c
or from menu : Edit>Copy Screen
按Command + control + c
或 从菜单:Edit>Copy Screen
open "Preview" app, Press Command + n
or from menu : File> New from clipboard
, then you can save command+s
打开“预览”应用程序,按Command + n
或 从菜单:文件>从剪贴板新建,然后您可以保存command+s
For Retina, activate iOS Simulator then on menu:
HardWare>Device>iPhone (Retina)
and follow above process
对于 Retina,激活 iOS Simulator 然后在菜单上:
HardWare>Device>iPhone (Retina)
并按照上述过程
Command + S
is the way to save on Desktop, (on new iPhone simulators, this was introduced in later simulator)
是在桌面上保存的方式,(在新的 iPhone 模拟器上,这是在后来的模拟器中引入的)
回答by Mujah Maskey
Press Command+Shift+4
and then keep the mouse pointer on Simulator and then press "Space Bar"
key one camera icon will appear, now left click
the mouse. Your simulator screen shot is saved on desktop. You can take the screen shot any small screen in the same way.
按下Command+Shift+4
然后将鼠标指针保持在模拟器上,然后按下"Space Bar"
键 将出现一个相机图标,现在left click
是鼠标。您的模拟器屏幕截图保存在桌面上。您可以以相同的方式拍摄任何小屏幕的屏幕截图。
回答by Janak Nirmal
You can google for IOS Simulator Cropper software useful for capturing screen shots and also easy to use with various options of taking snapshots like with simulator/without simulator.
您可以在谷歌上搜索 IOS Simulator Cropper 软件,该软件可用于捕获屏幕截图,并且易于使用各种选项来拍摄快照,例如使用模拟器/不使用模拟器。
UpdateJust pressing CMD+ Swill give you screenshot saved on desktop. Pretty easy huh..
更新只需按CMD+S会给你保存在桌面上的屏幕截图。很简单吧..
回答by bartosss
Since Xcode 8.2, you can also save a screenshot with the following command:
从 Xcode 8.2 开始,您还可以使用以下命令保存屏幕截图:
xcrun simctl io booted screenshot
xcrun simctl io booted screenshot
Further information in this blog: https://medium.com/@hollanderbart/new-features-in-xcode-8-2-simulator-fc64a4014a5f#.bzuaf5gp0
此博客中的更多信息:https: //medium.com/@hollanderbart/new-features-in-xcode-8-2-simulator-fc64a4014a5f#.bzuaf5gp0
回答by MaxEcho
- Focus simulator
Go to menu File->Save Screen Shot
or
Press ?+S
- 对焦模拟器
转到菜单文件-> 保存屏幕截图
或者
按?+S
Screen shot saves in desktop
屏幕截图保存在桌面
回答by Mehul
Simple answer with sample answer ;-)
带有示例答案的简单答案;-)
on iOS Simulator,
在 iOS 模拟器上,
Press Command + control + cor from menu : Edit>Copy Screen
按Command + control + c或从菜单:编辑>复制屏幕
open "Preview" app, Press Command + nor from menu : File> Newfrom clipboard , then you can save Command + s
打开“预览”应用程序,按 Command + n或从菜单:文件>从剪贴板新建,然后您可以保存 Command + s
UnCheck Alpha
取消选中 Alpha
You can change Image dimension to your requirement.
您可以根据需要更改图像尺寸。
Here is the Final Image,For example
这是最终图像,例如
回答by Kasumi Gunasekara
First, run the app on simulator. Then, use command+s, or File-> Save Screenshotin Simulator to take necessary and appropriate shots. The screenshots will appear on your desktop by default.
首先,在模拟器上运行应用程序。然后,使用command+ s或File-> Save Screenshotin Simulator 来拍摄必要和适当的截图。默认情况下,屏幕截图将显示在您的桌面上。
回答by Deepak Tagadiya
First method:
第一种方法:
Select simulator and press "command + s" button. Screenshot saved on desktop.
选择模拟器并按“ command + s”按钮。屏幕截图保存在桌面上。
Second method:
第二种方法:
Select simulator and go to "File > New Screenshot". Screenshot saved on desktop.
选择模拟器并转到“文件>新屏幕截图”。屏幕截图保存在桌面上。