文件相关
- command + n 新文件
- command + shift + n 新项目
- command + o 打开
- command + s 保存
- command + shift + s 另存为
- command + w 关闭窗口
- command + shift + w 关闭文件
- command+shift+O 搜索文件并打开
编辑
- command + [ 左缩进
- command + ] 右缩进
- command + control + left 折叠
- command + control + top 折叠全部函数;
- command + d 添加书签
- control + . 参数提示
- esc 自动提示列表
- command+, 呼叫出偏好设置
调试
- command + : 设置或取消断点;
- command + option + : 允许或禁用当前断点;
- command + option + b: 查看全部断点;
- command + r: 编译并运行(根据设置决定是否启用断点);
- command + r: 编译并运行(不触发断点);
- command + y: 编译并调试(触发断点);
- command + .:停止运行
- command + shift + r: 终止运行或调试;
- command + b: 编译;
- command + shift + b:内存泄露编译
- command + shift + r:内存泄露编译并运行
- command + shift + k: 清理
视图、导航
- command+0:Show/Hide left tool panel
- command+1-8:Project/Symbol/Find/Issue/Test/Debug/Breakpoint/Log Navigator
- option+command+0:Show/Hide right tool panel
- option+command+1:show the file inspector
- option+command+2:show quick help inspector
- control+1:Show Related Items(例如Callers/Callees、Includes/Included By)。可输入实时搜索匹配。
- control+2/3:Show Previous/Next History。可输入实时搜索匹配。
- control+4:Show Top Level Items
- control+5:Show Group Files(当前文件夹内的所有文件)。可输入实时搜索匹配。
- control+6:Show Document Items(当前文件的Symbols)。可输入实时搜索匹配。可直接选中符号,然后“Navigate->Reveal in Symbol Navigator”,打开该接口的符号列表。
- command+J:焦点切换(Move Focus),可配合鼠标和方向键。带‘+’的“Move focus to a new assistant editor”可以快速在辅助编辑窗口中打开头文件(.h)/实现文件(.m,*.mm)。
- shift+command+J:在项目导航中定位当前文件(Reveal in Project Navigator)。
基本操作
- command+shift+[/]:切换标签页
- 单指左右滑动(control+command+←/→):在单标签页打开的多个文件间切换
- option+command+←/→:折叠当前代码块
- option+shift+command+←/→:折叠该文件内所有代码块(方法/函数)
- option+command+[/]:Move Line Up/Down
- shift+command+Y:显示控制台(Show/Hide the debug area)
- option+command+R:编辑配置(Edit Scheme)
- 括号匹配:双击某个分隔符(如{}、()、[] 等),Xcode会选中匹配代码块。
- 焦点列:灰色深度与代码嵌套深度相关,鼠标悬停可突出显示右侧相应代码块,鼠标单击可折叠右侧相应代码块(Code Folding)。
说明:从左到右,依次是“导航窗格(Navigator)->边列(Gutter)->焦点列(Focus Ribbon)->代码编辑窗口(Standard Editor)”。
辅助编辑窗口(Assistant Editor)
- option+command+enter:打开Assistant Editor。
- command+enter:关闭Assistant Editor。
- 使用快捷键进行切换或跳转动作时,若同时按下option可以在辅助编辑窗口中打开相应文件或符号(For optional navigation (Option-clickingor Option-choosing a file), opens the file in a new Assistant editor pane.)。若在辅助窗口中操作,则在主窗口(Standard Editor)中打开。
- option+点击Project Navigator中选中的文件:在辅助编辑窗口中打开选中文件。
- option+command+点击Editor中选中的符号:在辅助编辑窗口中打开符号定义(jump to definition in assistant editor)
- option+control+command+↑/↓:在辅助窗口中打开对应的头文件(.h)/实现文件(.m,.mm,.cc)。
- 点击查看shift+command+O
- shift+command+F(command+3)选中的文件或符号时,可同时按下option在辅助编辑窗口中打开。
- 在control+1~6中打开选择结果时,均可同时按下option在Assistant Editor中打开。
- 若在按下option的同时按下shift通常会出现一个导航窗格,可选择在new window/tab/assistant-editor显示打开。
帮助文档(Documentation and API References Help)
- option+点按:查看选中符号的帮助提示(Quick Help for Selected Item)。
- option+双击:打开选中符号的帮助文档
编辑断点(Edit Breakpoint)
- F6:下一步(Step Over),逐过程单步调试,不进入函数体。
- (fn+)F7:进入(Step Into)函数体。可能与多媒体键有冲突,故需要fn辅助。
- (fn+)F8:跳出(Step Out)函数体。可能与多媒体键有冲突,例如呼叫iTunes,故需要fn辅助。
- control+command+Y:逐断点(continue)继续执行。
- shift+command+M:Debug Workflow->View Memory。
- command+shift+K:Debug Workflow->Clear Console。
Debug Workflow->ShowDisassembly When Debugging,可进行汇编指令级调试。
这篇博客详细介绍了Xcode的各种快捷键,包括文件操作、编辑、调试、视图导航、辅助编辑窗口和帮助文档等。例如,command + n 创建新文件,command + s 保存,command + r 编译并运行,command + shift + r 进行内存泄露编译,以及各种代码折叠、调试和导航的快捷方式。
950

被折叠的 条评论
为什么被折叠?



