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

你的呢?


当前回答

Cmd+Option+O to open a file in a separate window. Can configure Tab to always indent. I frequently use it to indent an entire file. Ctrl+Arrow keys to move between camel case words. If you have OneTwo, you can move from One to Two with Ctrl+Right arrow. You can use emacs bindings, there's even kill ring! I use the Ctrl+w and Cmd+C together when I need to copy two different pieces of text. In the documentation browser, you can restrict your searches to a particular library, e.g., just iOS 4.2 library. This helps me focus on API available only on a particular iOS/Mac version of the SDK. Cmd+Shift+A to build and analyze.

其他回答

触控板:

向上滑动三个手指-在头文件和源文件之间切换,这比Cmd + Opt + Up更容易; 向下滑动三个手指-在选择类或方法时切换声明和定义,目前发现这两种; 向左滑动三个手指-返回(Cmd + Opt + left); 向右滑动三个手指-前进(Cmd + Opt +右);

用Xcode 3.2.5测试。

Cmd+Option+O to open a file in a separate window. Can configure Tab to always indent. I frequently use it to indent an entire file. Ctrl+Arrow keys to move between camel case words. If you have OneTwo, you can move from One to Two with Ctrl+Right arrow. You can use emacs bindings, there's even kill ring! I use the Ctrl+w and Cmd+C together when I need to copy two different pieces of text. In the documentation browser, you can restrict your searches to a particular library, e.g., just iOS 4.2 library. This helps me focus on API available only on a particular iOS/Mac version of the SDK. Cmd+Shift+A to build and analyze.

突出显示代码块(重点跟随选择)

从View -> Code Folding -> Focus Follows Selection或controlloptionf激活“Focus Follow Selection”。

这也适用于Python代码,但是在一行中引入空格会使它失效。为了解决这个问题,安装谷歌的Xcode插件,并在它安装的首选项中激活“正确的保存空白”。这将在每次保存文件时清除尾随的空白,因此如果高亮显示出错,您只需保存文件,它就会再次工作。(看,这实际上是两个提示在一起,因为插件的这个特性本身很有用)。

下面是我刚刚写的一些随机Python代码的示例。我使用午夜Xcode语法着色主题。

这对于代码的高嵌套部分非常有帮助,可以跟踪内容在哪里。另外,注意左边,就在行号的右边,这些部分也是有颜色的。这是代码折叠条。如果你把鼠标滑下,它会高亮鼠标下方的部分。这些彩色条都可以折叠,换句话说,代码中高亮显示的部分正是可以折叠的部分。

Cmd + Ctrl + up / down折叠或展开所有函数。

Control+R将所选文本作为shell脚本执行,该脚本将在选择后返回粘贴的输出!