Search code examples
objective-cxcode4keyboard-shortcuts

How to jump to counterpart definition of current method in Xcode4 with shortcut key?


If a class defined as like this,

// A.h
@interface A
- (void)m1;  // I want to jumpt to here directly.
@end

// A.m
@implementation
- (void)m1
{
  // Caret here.
}
@end

I editor caret is places in method implementation body, is there a way to jump to it's definition directly with shortcut key? I can switch to header by pressing CMD + CTRL + UP, however jumped position is not where I want.


Solution

  • Edit: Just found it, Command-click on the function name.

    Edit2: When I press command the function name turns into a link like the picture below:

    screenshot

    Clicking on it takes you to the definition and vice versa.

    But since you're looking for a shortcut, CMD + CTRL + D takes you to the definition file and back. You have to put your cursor in the function name though.

    Later Edit: Here's a complete list of Xcode 4 keyboard shortcuts.