文件相關
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,可進行彙編指令級調試。