How can I find a line number in Xcode?

后端 未结 8 1498
小鲜肉
小鲜肉 2021-02-03 16:53

I have a function in my *.m file

- (void)myFunction {}

How can I find the line number this function?

相关标签:
8条回答
  • 2021-02-03 17:14

    You can go to:

    Xcode > Preferences > Text Editing
    

    then tick "Line numbers". Go to your method and you'll see the appropriate line number shown in the left-hand border of the text editor.

    0 讨论(0)
  • 2021-02-03 17:20

    Shortcut cmd+L. Enter line number.

    or

    cmd+O. $CLASS_NAME:$LINE_NUMBER.

    And your XCode goes to the line and highlights it!

    0 讨论(0)
  • 2021-02-03 17:22

    Keep Xcode top on Mac-Screen than press "command" and "comma key btn" a xcode preferences popbox will open given below: than click on "Text Editing" menu below given window will open here you on top written "show" with "Line numbers" just check it and thats it.

    Happy Coding!!!

    0 讨论(0)
  • 2021-02-03 17:26

    This can also be done through code when your implementation file grows. I have found this very useful to track and debug through tedious code. NSLog(@"\nFunction: %s\t\tLine: %d\n\n",func, LINE);

    For example, in some class called MyClass:

    - (void) someFunction {
        NSLog(@"\nFunction: %s\tLine: %d\n\n",__func__, __LINE__);
    }
    

    ==== Output ===

    Function: -[myClass someFunction]          Line: 175
    
    0 讨论(0)
  • 2021-02-03 17:31

    In Xcode 7

    Xcode > Preferences > Text Editing
    check the Line numbers

    0 讨论(0)
  • 2021-02-03 17:31

    Still applies in Xcode 8

    Xcode > Preferences > Text Editing

    0 讨论(0)
提交回复
热议问题