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

你的呢?


当前回答

切换到头文件/源文件

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

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

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

其他回答

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

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.

重命名多个项目共享的文件:

打开所有项目。 重命名一个项目中的文件。 Xcode自动调整所有打开的项目,以反映文件的新名称。

Xcode支持文本宏,可以通过编辑菜单末尾的插入文本宏菜单调用。它们也可以使用Code Sense (Xcode的代码补全技术)来调用。

例如,键入键序列pi m control-period将插入#import "file"到你的代码中,file作为一个可编辑的标记,就像代码完成一样。

普拉格玛市场

例子:

#pragma mark === Initialization ===

将这一行写在所有初始化方法之上,将在编辑器上方的下拉菜单中生成一个漂亮的标题。

开很快

Shift + cmd + D 开始输入你想打开的文件名。如果你在寻找框架头文件,这很酷。它们也有很好的注释,有时是文档的附加信息。

ESC

例如,当文本光标指向一个不完整的方法名时,按ESC键。它将搜索所有可能适合的内容,并且您可以快速完成非常大的方法名。如果您不能准确地记住一个方法的名称,这也很好。只需按ESC键。

我认为这些是我迄今为止知道的最好的。

(从被Stack Overflow用户删除的问题迁移过来,谢谢。)

CTRL + Alt +⌘+ r清除日志