I have a function in my *.m file
- (void)myFunction {}
How can I find the line number this function?
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.
转到 Xcode Preferences > Text Editing > Show: Line numbers 以在编辑器上显示行号。
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
如果键入 command L 并输入所需的行号,则可以跳转到 Xcode 5 中的行号。
Xcode > Preferences > Text Editing
check the Line numbers
Still applies in Xcode 8
Xcode > Preferences > Text Editing
Shortcut cmd+L
. Enter line number.
or
cmd+O
. $CLASS_NAME:$LINE_NUMBER.
And your XCode goes to the line and highlights it!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.