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

你的呢?


当前回答

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

其他回答

对我来说,它一直是:Command⌘+ 0:

在你调试或运行之后,如果你退出iPhone模拟器或调试应用,你会留下调试器窗口。

当你使用“单窗口布局”时,回到编辑器必须点击工具栏,这很烦人(加上你以后需要“删除细节窗格”)。

上面的快捷方式做到了这一点,并让您准备好编写代码。

无需重新编译的调试日志记录

cdespinosa的回答堆栈溢出问题我如何调试与NSLog(@“内部的iPhone模拟器”)?给出了一种不需要重新编译源代码的调试通过日志技术的方法。这是一个神奇的技巧,可以让代码摆脱调试的麻烦,有一个快速的周转,如果我早一点知道它,就可以为我省去无数的麻烦。

TODO comments

在注释前面加上TODO:将导致它显示在函数“快捷”下拉菜单中,例如:

int* p(0); // TODO: initialize me!

alt -左&右转到行尾/开始。这与ctrl -左&右一起移动到下一个大写字母或换行字。这两个帮我省了不少时间

使用xcodebuild命令行在共享构建机器上进行干净的构建:

cd project_directory
xcodebuild -configuration Release -alltargets clean
xcodebuild -configuration Release -alltargets

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.