简体   繁体   English

如何更改Xcode模拟器的默认文件名屏幕快照?

[英]How can I change default file name Xcode simulator screenshots?

Default name of Xcode simulator screenshots is ~/Desktop/Simulator Screen Shot - iPhone 8 Plus - YYYY-MM-SS at HH.MM.SS.png . Xcode模拟器屏幕截图的默认名称是~/Desktop/Simulator Screen Shot - iPhone 8 Plus - YYYY-MM-SS at HH.MM.SS.png

But I need file name without whitespace, so I have to change their name manually. 但是我需要没有空格的文件名,因此我必须手动更改其名称。

Do you know how can I change default name of them? 您知道如何更改它们的默认名称吗?

I use Xcode 9.3.1 and MacOS 10.13.4 我使用Xcode 9.3.1和MacOS 10.13.4

  1. Launch the Terminal and type the following command, replacing NewName with the file name you wish to use for your screen shot names 启动终端并键入以下命令,将NewName替换为您希望用于屏幕截图名称的文件名

    defaults write com.apple.screencapture name "NewName"

  2. Now restart SystemUIServer by killing it from the command line 现在通过从命令行杀死SystemUIServer来重新启动它

    killall SystemUIServer

  3. Take a screen shot to confirm the file name has been changed from default to the custom name 截屏以确认文件名已从默认名称更改为自定义名称

Only new screen shots will be effected by this change, existing screenshot file names will remain the same. 此更改将仅影响新的屏幕截图,现有的屏幕截图文件名称将保持不变。

Once the change has taken effect, all new screenshots will adopt the new name, and additional captures will be sequenced just as before so they don't overwrite one another. 更改生效后,所有新的屏幕截图都将采用新名称,并且其他捕获将像以前一样进行排序,因此它们不会彼此覆盖。

FYI. 仅供参考。 This is not tested, Just try and let me know it is working or not. 这未经测试,请尝试让我知道它是否有效。

UPDATE 更新

If you want to restore to the default naming convention of screen shot files created in Mac OS X, use the instructions below. 如果要还原为在Mac OS X中创建的屏幕截图文件的默认命名约定,请使用以下说明。

defaults write com.apple.screencapture name "Screen Shot"

Again restart SystemUIServer by killing it 通过杀死它来重新启动SystemUIServer

killall SystemUIServer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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