随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
当前回答
Control+R将所选文本作为shell脚本执行,该脚本将在选择后返回粘贴的输出!
其他回答
选择一个文本块并输入cmd-/将其注释掉。再次执行此操作以删除注释字符。
当通过双击平衡字符(括号、大括号、方括号)与大括号匹配结合使用时,这尤其有用。
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.
⌘'来正确格式化(重新缩进)您的代码
编辑:显然重缩进功能(编辑>格式>重缩进)没有默认的快捷方式。我想我很久以前就分配了一个(在Preferences > Key bindings中),甚至不记得了。抱歉误导你了。
Control+R将所选文本作为shell脚本执行,该脚本将在选择后返回粘贴的输出!
我刚从Windows世界来到Xcode(就像其他许多人一样),我遇到的第一个怪招就是尝试用TAB键“缩进选定的文本块”。
通常,当使用Windows编辑器时,您选择一个文本块,无论何时按TAB(或shift TAB)键,所选的文本都会右/左跳转。然后,一旦确定了文本的新位置,就停止按TAB键。
好吧,在Xcode中,这是完全不同的,因为当你按TAB键时,整块文本消失了,留给你一张愚蠢的脸,内心有些愤怒……
但后来,出于偶然或直觉或其他原因,有一天我发现了一些变通方法,可以达到你在正确的窗口编辑器下可能得到的相同效果。 步骤如下:
Select the text block as you might do under Windows. Instead of pressing TAB, leave your instincts away, and "copy the text block" (typically CTRL+C (yuck)). Then, without deselecting the text, (pressing SHIFT if needed), extend the beginning of the selection and place it on the position you would like your new text to appear. Paste the beforementioned text (typically CTRL+V (yuck again)). Result: The previous text block gets substituted by "the new" one (of course, itself), but the "auto indent" capabilities of Xcode (or someone else, who cares), will auto place the text starting onto the new position we chose in step 3. A big smile appears on your face.
这有点棘手,但当你习惯了,你会发现自己经常使用它。
享受! !