文本search虽然Xcode中的所有.xib文件?

这似乎是这样一个基本的任务,但我很难过。

在Xcode中,如何执行文本search(XML内容)项目中的所有.xib文件?

例如,我们所有的.xib文件都在第二行包含这个string: com.apple.InterfaceBuilder3.CocoaTouch.XIB 。 所以我认为search该string的所有项目文件将返回所有.xib文件,但Xcode坚持“0发生”。 我仔细检查了项目查找选项看起来是正确的。

我必须失去一些明显的东西。 (或Xcode是以某种方式硬编码跳过.xib文件。)

我试图find所有引用特定类的.xib文件(而文本search看起来是最直接的方式)。

谢谢!

我所做的是在terminal中运行grep:

 grep -i -r --include=*.xib "TextToFindHere" /PathToSearchHere 

Xcode似乎没有searchxib文件的选项,我试图让Spotlight查看它们是不成功的。

这是我的方便的命令,永远不会让我失望。 从terminal中的项目目录运行它。

找 。 -name“* .xib”-exec grep“文本查找”{} \; -打印

我可能很笨,但是使用聚光灯对我来说非常适合这个。

我意识到这是相当古老的,但我想build议你碰巧也在你的计算机上编写其他语言,并select使用Sublime Text 2 (这是非常棒的)这样做,只要打开你的iOS项目的文件夹在崇高和使用查找所有function。 非常快,非常可靠。

这就是我从我的大型项目中删除未使用的图像资源。

〜快乐编码=]

你可以在你的bashconfiguration文件中使用这个函数:

 function grep_xib { grep -i -r --include=*.xib "$1" . } 

然后在terminal“grep_xib TEXT_TO_FIND”中调用。 这很容易。

要在您的Mac上创build.bash_profile,请执行以下步骤:

  • 启动terminal
  • input“cd〜/”到您的个人文件夹
  • input“touch .bash_profile”来创build你的新文件。
  • 用你最喜欢的编辑器编辑.bash_profile(或者你可以input“open -e .bash_profile”在TextEdit中打开它。
  • 键入“.bash_profile”重新加载.bash_profile并更新您添加的任何function。

你可以通过定义一个新的范围来改变Xcode中的search范围。 转到search面板,在search栏下方有一个有三个点的图标(可能默认为“In Workspace”)。 点击search范围下的“新范围”。 将其定义为“名称”/“以”/“.xib”结尾。

这工作,如果你使用作为服务….

 on run {input, parameters} display dialog "XIB Search Text" default answer "" set searchtext to text returned of result if (length of searchtext) is greater than 0 then tell application "Xcode" to set theProjectPath to (the project directory of front project) tell application "Terminal" set newWin to do script "cd " & theProjectPath & "; " & "rm " & theProjectPath & "/searchXIB.txt 2> /dev/null ; grep -i -r --include=*.xib " & searchtext & " . > searchXIB.txt ; exit" activate repeat while (exists newWin) delay 1 end repeat tell application "Xcode" set doc to open theProjectPath & "/searchXIB.txt" activate end tell tell application "System Events" keystroke "f" using {command down} keystroke searchtext end tell end tell end if return input end run 

以崇高的文字打开项目文件夹,search所有文件,非常简单方便。

我有同样的问题,我解决了它使用一些控制台命令。

1)在Mac上打开terminal

2)运行“ grep -i -r –include = *。xib”searchtext“/ your / project / path ”命令

它会searchpath“/你/项目/path”,并将打印使用“search文本”的所有文件xib的完整path。

希望对你有帮助!