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

你的呢?


当前回答

选择一个文本块并输入cmd-/将其注释掉。再次执行此操作以删除注释字符。

当通过双击平衡字符(括号、大括号、方括号)与大括号匹配结合使用时,这尤其有用。

其他回答

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

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.

双击方括号或圆括号,可获得括号与圆括号匹配。

在打开的文件之间来回导航: ⌥⌘← ⌥⌘→

当键入一个方法时,按ESC键查看代码完成选项(毫无疑问,这已经在前面提到过)。我已经知道这一点,但今天我发现,如果你按下代码完成窗口右下角的按钮(它要么是'A',要么是Pi),你可以在字母排序和按类层次排序之间切换。

突然之间,这个窗口就有用了!

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

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