XCode:快速打开属性列表文件,例如 info.plist 作为源代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35768948/
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
XCode: Quick open property list file e.g. info.plist as source code?
提问by Awsed
In Xcode you can "quick open" files by selecting File/Open Quickly
. When I enter the file name of a plist file, then this file is opened as "Property List". But often I want to open the file as "Source Code". How can I quick open property list files as source code?
在 Xcode 中,您可以通过选择“快速打开”文件File/Open Quickly
。当我输入 plist 文件的文件名时,该文件将作为“属性列表”打开。但我经常想将文件作为“源代码”打开。如何快速打开属性列表文件作为源代码?
回答by Awsed
回答by Suz
Hmmm....I don't think you can, unless you set up the Open As > source code commands as a custom behavior with a key binding.
嗯......我不认为你可以,除非你将 Open As > source code 命令设置为带有键绑定的自定义行为。
Apple is discouraging opening plists as raw XML. Their guidance on how to deal with .plists is here
Apple 不鼓励以原始 XML 格式打开 plist。他们关于如何处理 .plist 的指导在这里
I was able to accomplish most of what I needed with that, especially after discovering the trick for showing the actual names of the keys:
我能够用它完成我需要的大部分工作,尤其是在发现了显示键的实际名称的技巧之后:
Important:The property list editor in Xcode displays human-readable strings (instead of the actual key name) for many keys by default. To display the actual key names as they appear in the Info.plist file, Control-click any of the keys in the editor window and enable the Show Raw Keys/Values item in the contextual menu.
重要提示:默认情况下,Xcode 中的属性列表编辑器会为许多键显示人类可读的字符串(而不是实际的键名)。要显示 Info.plist 文件中出现的实际键名,请按住 Control 键并单击编辑器窗口中的任意键并启用上下文菜单中的 Show Raw Keys/Values 项。
If you still need to see the .plist source, though, there are two ways:
但是,如果您仍然需要查看 .plist 源代码,有两种方法:
1) show the version editor. The source of the previous and current versions are shown side by side.
2) use the file browser... (there should be a way to automate this with Xcode behaviors)
2)使用文件浏览器......(应该有一种方法可以使用Xcode行为自动执行此操作)
- Hold the Control key while selecting the file in the file browser.
- Select 'Open As..'
- Select 'Source Code'
- 在文件浏览器中选择文件时按住 Control 键。
- 选择“打开为..”
- 选择“源代码”
It's certainly not as fast as OpenQuickly, but it does work.
它当然不如 OpenQuickly 快,但它确实有效。