- 常见快捷键
⌘ + B:编译。
⌘ + R:运行。
⌘ + U:测试。
⌘ + .:停止。
⌃ + ⌘ + E:重命名。
⌃ + I:代码格式化。
⌃ + ⌘ + Click:跳转到点击内容的定义位置。
⌥ + ⌘ + /:添加文档注释。
⌘ + F:文件内查找。
⇧ + ⌘ + F:项目内查找。
⇧ + ⌘ + K:清理项目。
⌃ + ⌘ + → 和 ⌃ + ⌘ + ←:在最近打开的文件之间来回切换。
⌃ + ⌘ + ↑:生成当前文件的 interface。
⌘ + ⌥ + [ 和 ⌘ + ⌥ + ]:对选中代码进行上下移动。
⌘ + \:在当前行上添加或删除断点。
⌃ + 6:快速查看当前文件的方法列表。
⌃ + ⌘ + R:不编译直接运行(与QQ的录屏冲突)。
- 窗口
在Xcode顶部打开/新增一个Tab栏(当需要在多个页面来回切换、修改时,这个功能的价值就体现出来了,超好用) New Tab : comman + T
// 2. 新建/分离一个窗口 New Window : Shift + command + H
// 5. 新建工程 New Project... : Shift + command + N
// 7. 在当前位置新建一个分组(文件夹) // 注意:以这种方式新建的文件夹只在Xcode中,在实际的项目工程文件路径下不会产生 New Group : option(alt) + command + N
// 8. 添加一个已有的文件到工程中(这个一般用不到,因为可以直接拖进来嘛,更方便) Add Files... : option(alt) + command + A
// 10. 弹出一个搜索框,搜索要打开的文件(相比较上面一个,这个更方便、快速) Open Quickly... : Shift + command + O
// 11. 关闭窗口 Close Window : Shift + command + W
// 12. 关闭一个Tab(当只有一个Tab时,会关闭当前窗口) Close Tab : command + W
// 13. 关闭其他窗口 Close Other Windows : Ctrl + option(alt) + command + W
// 14. 关闭当前文档 Close Document : Ctrl +command + W
// 17. 保存所有文件 Save All : Option(alt) + command + S
- 编辑区
// 10. 重复 Duplicate : command + D
// 2. 快速切换左边导航区域 command 加 1 到 8 // 3. 快速打开/关闭左边的导航区域 command + 0
// 1. 在工作空间搜索 Find in Workspace... : Shift + command + F
// 2. 在工作空间查找和替换 Find and Replace in Workspace... : Option(alt) + Shift + command + F
// 3. 在当前页面搜索 Find... : command + F
// 4. 在当前页面查找和替换 Find and Replace... : Option(alt) + command + F
// 1. 快速定位到当前编辑文件的导航区域(左侧的文件目录) Reveal in Project Navigator : Shift + command + J
// 6. 快速定位到当前光标的位置 Jump to Selection : Shift + command + L
// 1. 快速跳到指定行 Jump To... : command + L
// 1. 向左或向右移动代码 command + [ 或 command + ]
// 2. 向上或向下移动代码 Option(alt) + command + [ 或 Option(alt) + command + ]
// 4. 快速添加文档注释 Option(alt) + command + /
// 5. 快速收缩/打开代码块 Option(alt) + command + ← / Option(alt) + command + →
// 6. 快速收缩/打开所有代码块 Option(alt) + Shift + command + ← / Option(alt) + Shift + command + →
// 1. 运行 Run : command + R / Option(alt) + command + R
// 2. 测试 Test : command + U / Option(alt) + command + U
// 3. ProFile Profile : command + I / Option(alt) + command + I
// 4. Analyze Analyze : Shift + command + B / Option(alt) + Shift + command + B
// 5. 直接运行程序,没有对当前代码重新进行编译 Run Without Building : Ctrl + command + R
// 6. 编译 Build : command + B
// 7. 清空
Clear : Shift + command + K
// 8. 清空运行产生的文件夹和产品 Clear Build Folder : Option(alt) + Shift + command + K
// 9. 停止运行 Stop : command + .
// 1. 开启关闭所有的断点 Activate Breakpoints : command + Y
// 2. 为当前行添加/删除断点 Add Breakpoint at Current Line : command + \
// 3. 创建符号断点 Create Symbolic Breakpoint... : Option(alt) + command + \
// 4. 清空控制台 Clear Console : command + K
// 1. 返回至上一次光标位置 Ctrl + command + ← , Ctrl + command + →
// 2. 快速查看当前class的方法 Ctrl + 6
// 3. 打开控制台 Shift + command + R
// 4. 删除选中的整行 Ctrl + Y
修改,增加快捷键 https://www.jianshu.com/p/cc6e13365b7e
显示/隐藏下面 Debug 区: Command + Shift + Y
control + B 前移光标
control + F 后移光标
control + p 移动光标到上一行
control + N 移动光标到下一行
control + Q 移动光标到本行行首
control + E 移动光标到本行行尾
control + K 删除本行
control + D 删除光标右边的字符(一个字符)
control + L 将插入点置于窗口正中
command + → 移动到一行末尾
command + delete 删除一行代码,和上一个快捷键组合使用
control + i 根据当前行代码所在位置自动调整缩进(可以先command + a全选然后调整所有代码的缩进)
control + command + e 重构变量名,将光标放在变量名上或者双击选中这个变量,然后按该快捷键,就可以实现当前文件下所有用到该变量的地方进行修改
代码补全 esc
格式化代码control + I
查看引用 control + command + shift + H
光标去行首 control + A | command + ←
光标去行尾 control + E | command + →
删除左侧剩余字符 command + delete
删除右侧剩余字符 control + K
增加删除一行,拷贝一行快捷键
code /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
在 Deletions 下面增加
在 Insertions and Indentations 下面增加
配置快捷键 删除一行 command + shift + k 拷贝当前行 option + shift + 上下方向键