随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。

你的呢?


当前回答

使用类浏览器显示继承的方法

Apple's API reference documentation does not show methods inherited from a superclass. Sometimes, though. it's useful to be able to see the full range of functionality available for a class -- including a custom class of your own. You can use the Class Browser (from the Project menu) to display a flat or hierarchical list of all the classes related to a current project. The upper pane on the right hand side of the browser window shows a list of methods associated with the object selected in the browser. You can use the Configure Options sheet to select "Show Inherited Members" to show inherited methods as well as those defined by the selected class itself. You click the small book symbol to go to the corresponding documentation.

其他回答

自动完成键盘快捷键

选项卡⇥或控制⌃/:选择下一个自动完成参数。

Shift: Tab⇥或Shift: Control⌃/:选择之前的自动完成参数。

Escape⎋:显示自动完成弹出列表。

切换到头文件/源文件

选项命令⌘向上箭头↑ 查看>切换到头文件/源文件

在。m和。h文件之间切换。

在Xcode 4中,这是ctrl⌘向上箭头↑

⌘-[和⌘-]缩进和取消所选文本。使清理源代码更加容易。

按下“⌘D”激活“Open this quick”,它会使用所选文本导航到“Open quick”的第一个结果。如果所选文本的格式为<filename:lineNumber>,(包含或不包含<>)“快速打开此文件”将带您到文件加行号。

你可以结合下面的建议:

你可以使用这个宏写包含日志条目的文件名和行号的日志:(确保在你的目标调试配置中使用的C标志上定义-DDEBUG=1)

#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s <%@:%d> " fmt), __PRETTY_FUNCTION__, [[NSString stringWithFormat:@"%s", __FILE__ ] lastPathComponent] ,__LINE__, ##__VA_ARGS__)
#else
#define DLog(format, ...)
#endif

在DLog()输出中,双击“<”字符选择<filename:lineNumber>,然后按下“⇧⌘D”将打开源代码中日志所在的行。

看看一个关于“在Xcode中变得高效”的视频:becoming-productive-in- Xcode