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

你的呢?


当前回答

自动完成键盘快捷键

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

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

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

其他回答

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

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代码格式化…当你想要编写代码时,它是你需要的东西之一吗 可读性和外观良好。

您可以自己格式化代码,也可以使用脚本节省时间。

一个好方法是…使用Uncrustify。在Xcode中的代码格式化中有解释。

切换到头文件/源文件

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

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

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

使用^T来交换前面两个字母

这适用于所有Cocoa应用程序,但我尤其喜欢在编码时使用它。使用^T (Control-T)来交换插入符号旁边的两个字母,或者当插入符号在末尾时,交换插入符号前面的两个字母。例如:

fi^T

... 就变成:

if

... 这是我经常犯的错别字。

我发现使用快捷方式来构建/清理和运行你的项目真的节省了我一些时间:

Cmd-R:构建并运行 Cmd-Y:构建和调试 Cmd-Shift-Enter:停止运行项目 Cmd-Shift-K:清洁构建