I have a function in my *.m file
我的*中有一个函数。m文件
- (void)myFunction {}
How can I find the line number this function?
如何找到这个函数的行号?
7 个解决方案
#1
169
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
5
Go to Xcode Preferences > Text Editing > Show: Line numbers to show the line numbers on the editor.
转到Xcode首选项>文本编辑>显示:行号显示编辑器上的行号。
#3
4
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);
这也可以在实现文件增长时通过代码实现。我发现这对于跟踪和调试冗长的代码非常有用。NSLog(@“\ nFunction:% s \ t \ tLine:% d \ n \ n”,函数、线);
For example, in some class called MyClass:
例如,在一个叫做MyClass的类中:
- (void) someFunction {
NSLog(@"\nFunction: %s\tLine: %d\n\n",__func__, __LINE__);
}
==== Output ===
= = = = = = =输出
Function: -[myClass someFunction] Line: 175
#4
3
If you type command L and enter the desired line number, then you can jump to the line number in Xcode 5.
如果输入命令L并输入所需的行号,则可以跳到Xcode 5中的行号。
#5
3
In Xcode 7
Xcode > Preferences > Text Editing
check the Line numbersXcode >首选项>文本编辑检查行号
#6
1
Still applies in Xcode 8
仍然适用于Xcode 8
Xcode > Preferences > Text Editing
Xcode >首选项>文本编辑
#7
0
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.
在mac屏幕上保持Xcode在顶部,而不是按“command”和“逗号键btn”,下面会打开一个Xcode首选项弹出框:点击下面的“文本编辑”菜单,在给定的窗口中,你会在上面写上“show”和“Line number”,只要选中它,就行了。
Happy Coding!!!
编码快乐! ! !
#1
169
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
5
Go to Xcode Preferences > Text Editing > Show: Line numbers to show the line numbers on the editor.
转到Xcode首选项>文本编辑>显示:行号显示编辑器上的行号。
#3
4
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);
这也可以在实现文件增长时通过代码实现。我发现这对于跟踪和调试冗长的代码非常有用。NSLog(@“\ nFunction:% s \ t \ tLine:% d \ n \ n”,函数、线);
For example, in some class called MyClass:
例如,在一个叫做MyClass的类中:
- (void) someFunction {
NSLog(@"\nFunction: %s\tLine: %d\n\n",__func__, __LINE__);
}
==== Output ===
= = = = = = =输出
Function: -[myClass someFunction] Line: 175
#4
3
If you type command L and enter the desired line number, then you can jump to the line number in Xcode 5.
如果输入命令L并输入所需的行号,则可以跳到Xcode 5中的行号。
#5
3
In Xcode 7
Xcode > Preferences > Text Editing
check the Line numbersXcode >首选项>文本编辑检查行号
#6
1
Still applies in Xcode 8
仍然适用于Xcode 8
Xcode > Preferences > Text Editing
Xcode >首选项>文本编辑
#7
0
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.
在mac屏幕上保持Xcode在顶部,而不是按“command”和“逗号键btn”,下面会打开一个Xcode首选项弹出框:点击下面的“文本编辑”菜单,在给定的窗口中,你会在上面写上“show”和“Line number”,只要选中它,就行了。
Happy Coding!!!
编码快乐! ! !