Xcode 查找调用函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2038257/
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 find caller functions
提问by genesys
In Xcode, how can I find all caller functions of a specific function?
在 Xcode 中,如何找到特定函数的所有调用函数?
回答by David T.
Xcode 4.5 (in beta) has this functionality. when you highlight say... a function, you can check the "caller" and "callee"
Xcode 4.5(测试版)具有此功能。当您突出显示...一个功能时,您可以检查“调用者”和“被调用者”
editi believe it's located at the top left of the file panel for that file... so double click on the function to highlight it, and you click on on the file panel options (the one that has the "open recent, open unsaved...etc" drop down
编辑我相信它位于该文件的文件面板的左上角...所以双击该功能以突出显示它,然后单击文件面板选项(具有“打开最近的,打开未保存的...等”下拉
EDIT #2
编辑#2
here's a picture to clarify (since i dont know what this menu button is called):
这是一张需要澄清的图片(因为我不知道这个菜单按钮叫什么):
ALSO - XCode 4.5 is no longer beta, i believe, and is actually out in public
另外 - 我相信 XCode 4.5 不再是测试版,而且实际上已经公开了
EDIT #3
编辑 #3
also note that this caller thing does NOT search for being called under the performSelector
method, as in, the particular caller that has this performSelector
won't show up if you had done something like:
还请注意,此调用者事物不会搜索在该performSelector
方法下被调用,因为performSelector
如果您执行了以下操作,则不会显示具有此调用者的特定调用者:
[self performSelector:@selector(checkIfShouldStopMovement) withObject:nil afterDelay:0.25];
回答by pille
In XCode 4.5, the quickest method is this:
在 XCode 4.5 中,最快的方法是这样的:
- Select method in code (double click or mark using your mouse cursor)
- Press Ctrl+1
- Select "Callers" from the pop-up menu.
- 在代码中选择方法(双击或使用鼠标光标标记)
- 按Ctrl+1
- 从弹出菜单中选择“来电者”。
This is the shortcut for going View->Standard Editor->Show Related Items in XCode's title menu.
这是在 XCode 的标题菜单中转到 View->Standard Editor->Show Related Items 的快捷方式。
回答by uiroshan
use ?+Ctrl+Shift+H key combination on XCode 7 onwards.
在 XCode 7 以后使用 ?+Ctrl+Shift+H 组合键。
回答by Brian Webster
This can also be accessed via the assistant editor, as shown in the screenshot below. Whichever method you have the insertion point in in the main editor on the left will have its callers displayed in the assistant editor. I've found this to be the best way of looking through each caller in succession, since once you have "Callers" selected, you can then select the next caller via the next pop-up menu to the right in the jump bar.
这也可以通过助手编辑器访问,如下面的屏幕截图所示。无论您在左侧的主编辑器中有插入点的哪种方法,其调用者都会显示在辅助编辑器中。我发现这是连续查看每个来电者的最佳方式,因为一旦您选择了“来电者”,您就可以通过跳转栏中右侧的下一个弹出菜单选择下一个来电者。
回答by user18853
In Xcode-7 you have the functionality of getting call-heirerchy. Right-click on the function and click "Find Call Hierarchy": image reference:
在 Xcode-7 中,您具有获取 call-heirerchy 的功能。右击函数,点击“Find Call Hierarchy”: 图片参考:
回答by king_T
回答by drpawelo
Press ?+Ctrl+Shift+H
shortcut when a method of interests is selected (with a mouse or cursor). (as per @uiroshan 's answer)
按?+Ctrl+Shift+H
当选择(用鼠标或光标)的利益的方法快捷方式。(根据@uiroshan 的回答)
But you can also specify any another shortcut in XCode -> Preferences -> Key Bindings
但是您也可以在其中指定任何其他快捷方式 XCode -> Preferences -> Key Bindings
回答by Adam Wo?
Use Find in Project as Text or as Symbol.
使用在项目中查找作为文本或符号。
AFAIK, there's no equivalent to e.g. Call Hierarchy known from Eclipse or NetBeans.
AFAIK,没有等效于例如从 Eclipse 或 NetBeans 已知的调用层次结构。
回答by obiwahn
Strangely the refactoring tool can detect all method calls but not the search.
奇怪的是,重构工具可以检测所有方法调用,但不能检测搜索。
So I simply use it to rename my method to a unique name (eg. reset to resetPlayer) and then use the new name in a regular textual search.
所以我只是使用它来将我的方法重命名为唯一的名称(例如重置为 resetPlayer),然后在常规文本搜索中使用新名称。
1.) Menu > Edit > Refactor... > Rename to unique name
1.) 菜单 > 编辑 > 重构... > 重命名为唯一名称
2.) search for the new name
2.) 搜索新名称
回答by Ixx
The functionality is available in XCode 4.4.1, see this: http://smilingfinney.blogspot.de/2012/09/method-callers-in-xcode-44.html
该功能在 XCode 4.4.1 中可用,请参阅:http: //smilingfinney.blogspot.de/2012/09/method-callers-in-xcode-44.html