How can I find a line number in Xcode?

不打扰是莪最后的温柔 提交于 2019-12-20 10:32:41

问题


I have a function in my *.m file

- (void)myFunction {}

How can I find the line number this function?


回答1:


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.




回答2:


Go to Xcode Preferences > Text Editing > Show: Line numbers to show the line numbers on the editor.




回答3:


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



回答4:


If you type command L and enter the desired line number, then you can jump to the line number in Xcode 5.




回答5:


In Xcode 7

Xcode > Preferences > Text Editing
check the Line numbers




回答6:


Still applies in Xcode 8

Xcode > Preferences > Text Editing




回答7:


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!!!



来源:https://stackoverflow.com/questions/9769918/how-can-i-find-a-line-number-in-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!