Search code examples
xcodexcode4

Is there a way to jump to a specific method in Xcode?


I'm using Xcode 4.3 for Objective-C development. One feature that I like in other text editors (I know Xcode is an IDE), is jumping to a method definition within the same code file.

For example if I'm in @implementation of Calculator and calculator has 10 methods, I will like a way to jump between them.

If I press command+L I can jump to a specific line number, is there a way to jump in a similar way but to a method definition? e.g. instead of typing the line number to type only the beginning of the method name.

Can I open somehow a dialog box, type the beginning of a method signature and see instantly the search results and If I pick one method it will get me to it?

Is there a way to jump from a method to the next one?


Solution

  • I think this is what you're looking for:

    Type ctrl-6 to activate the "Show Document Items" in the "Jump Bar". Then start typing part of the method you are looking for to narrow the results.

    Example:

    To jump straight to - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

    Type ctrl-6, type "cellFor", arrow down so the method is highlighted, and press Enter. The Editor will jump right to that method.

    Incidentally, you can use ctrl-1, ctrl-2, ctrl-3, etc. to access the different sections of the "Jump Bar".