随着大量的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.

其他回答

按下“⌘D”激活“Open this quick”,它会使用所选文本导航到“Open quick”的第一个结果。如果所选文本的格式为<filename:lineNumber>,(包含或不包含<>)“快速打开此文件”将带您到文件加行号。

你可以结合下面的建议:

你可以使用这个宏写包含日志条目的文件名和行号的日志:(确保在你的目标调试配置中使用的C标志上定义-DDEBUG=1)

#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s <%@:%d> " fmt), __PRETTY_FUNCTION__, [[NSString stringWithFormat:@"%s", __FILE__ ] lastPathComponent] ,__LINE__, ##__VA_ARGS__)
#else
#define DLog(format, ...)
#endif

在DLog()输出中,双击“<”字符选择<filename:lineNumber>,然后按下“⇧⌘D”将打开源代码中日志所在的行。

按左/按右键导航变量或方法名中的单词。没有这个我活不下去。

触控板:

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

用Xcode 3.2.5测试。

快照,File>Make Snapshot,如果您没有使用适当的版本控制系统,提供了一种快速保存项目修订的方法。这是一种尝试巨大的、潜在的破坏性变化的好方法。

如果高亮显示搞砸了,如果你的变量没有高亮显示或其他任何东西,只需执行⌘-A⌘-X⌘-V,这将全部选中,剪切和粘贴,所有高亮显示将被纠正。所以只要按住⌘,然后按A X V。