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

你的呢?


当前回答

User Scripts菜单中有很多好东西,而且添加自己的脚本也相对容易。例如,我添加了一个快捷方式并将其绑定到cmd-opt—在我的代码中插入注释分隔符和#pragma标记来快速分解文件。

# !/bin/sh Echo -n "//================....================ #pragma mark”

当我点击cmd-opt——时,这些行被插入到我的代码中,光标被预先定位为编辑pragma mark组件,该组件显示在符号弹出框中。

其他回答

选择一个文本块并使用

Command + '/' 

注释掉该文本块。选择注释块,并使用相同的快捷方式取消注释。

能够快速查看可以从超类中重写的所有方法。例如,当扩展UITableViewController时,我只需要输入我的实现:

- ta

然后我按ESC键,看到我的超类中所有以“ta”开头的方法,比如

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

这也适用于采用协议。

我不知道是否每个人都知道这一点,但当我了解到我可以使用“代码折叠”并通过单击想要折叠的代码附近的灰色区域来隐藏我不想查看的嵌套函数时,我很高兴。

很难解释……

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.

事实上,我可以使用Emacs作为我的编辑器,Xcode作为我的构建器/调试器……在我看来,这是两全其美。