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

你的呢?


当前回答

“Ctrl+左/右箭头”进行字内文本导航。我使用这个特性将光标从变量中的一个“驼峰”跳转到下一个。

其他回答

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

- ta

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

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

这也适用于采用协议。

在shell构建阶段,您可以使用以下格式写入stderr:

<filename>:<linenumber>:错误|警告|备注:<消息>\n .

它与gcc用来显示错误的格式相同。filename:linenumber部分可以省略。根据模式(错误,警告,注意),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 + ~(波浪号-看起来很奇怪的按钮…)

在任何打开的Xcode窗口之间切换-也当多个项目打开时。

要“设置下一个语句”,只需将红色指令指针拖到下一行执行。(源)