參考CSDN資料,並且翻譯成繁中
說明:從左到右,依次是“ 導航窗格(Navigator)-> 邊列(Gutter)-> 焦點列(Ribbon)-> 代碼編輯窗口(Standard/Primary Editor)”。
邊列(Gutter ):顯示行號和斷點。
焦點列(Ribbon):灰色深度與代碼嵌套深度相關:鼠標懸停可突出顯示右側相應代碼塊(Focus code blocks on hover),鼠標單擊可折疊右側相應代碼塊(Code folding)。
通過“command+,” 快捷鍵或”Xcode|Preferences” 菜單可呼出偏好設置。
選中一種主題(theme),例如“Midnight”,推薦使用Monokai、Ciapre。將`*. dvtcolortheme `文件拷貝到`~/Library/Developer/Xcode/UserData/FontAndColorThemes/`即可安裝主題,重啟Xcode即可選用。
Xcode默認字體為menlo,也可選擇Consolas、Monaco、Consolas、Droid Sans Mono、Source Code Pro、Bitstream Vera Sans 等其他等寬字體。
shift 選擇主題Source Editor/Console 中的所有項,點擊Fonts 可更改字體(大小)。
Show Line Numbers:在gutter中顯示行號。
Code folding ribbon:顯示焦點列。
Focus code blocks on hover:鼠標懸停時突出顯示右側相應代碼塊。
Page guide at column:顯示一行最多支持80個字符的提示分割線。
Prefer indent using:Spaces(為保持一致的視覺呈現和行末註釋對齊,建議使用空格)
Tab width:4 spaces(tab expand,1個tab=4個空格)
Indent width:4 spaces(自動縮進步長=4個空格)
Activation:When a tab or window opens,make it active。當新建窗口或標籤時,立即激活聚焦。
Navigation:Uses Primary/Focused Editor。打開Project Navigator中指定的文件時,在主編輯器窗口/當前聚焦窗口打開,建議選擇Focused。
Optional Navigation:Uses Single Assistant Editor。打開Project Navigator中指定的文件或跳轉到符號定義所在文件(command+單擊)時,若按下option鍵,則在輔助窗口打開。
Double Click Navigation:Uses Separate Tab。雙擊打開Project Navigator中指定的文件或跳轉到符號定義所在文件(command+雙擊)時,新建標籤頁。
Enable Source Control:啟用/禁用Xcode自帶Source Control Manager( SCM )。
Comparison View:Show local revision in [Right] Side。打開version editor比較窗口時,左側顯示服務器基線版本(base),[右側]顯示本地修改過的工作拷貝(local working copy)。
Downloads:可下載Components(SDK&Simulator)和Documentation。
當選擇為Default時,Derived Data的目錄為~/Library/Developer/Xcode/DerivedData。
當選擇為Relative時,Derived Data的目錄為當前*.xcodeproj所在的目錄。
當選擇為Custom時,Derived Data的目錄需自定義。
不建議使用絕對路徑,因為寫死之後,換環境或換平台,又要重新修改路徑,且同名project target的build folder會覆蓋,建議使用相對路徑(Relative)
option+點按:查看選中符號的幫助提示(Quick Help for Selected Item)。
option+雙擊:打開選中符號的幫助文檔。
option+command+T: Show/Hide Toolbar
command+0: Show/Hide left tool panel(Navigator Area)
command+1-8:Project/Source Control/Symbol/Find/Issue/Test/Debug/Breakpoint/Report Navigator
option+command+0: Show/Hide right tool panel(Utility Area)
option+command+1/2: show the file/quick help inspector
再按下⌥⌘ T隱藏頂部工具欄,再按下⌘ 0 / ⌥⌘ 0 隱藏左右側邊欄,聚焦中間的編輯區(Standard/Primary Editor),有效利用屏幕編碼。
control+1:Show Related Items(例如 Superclasses/Subclasses、Callers/Callees、Protocol Implementor/Implemented、Includes/Included By),支持即時搜,比較常用。
control+2 /3:Show Previous /NextHistory,支持即時搜。
control+4:Show Top Level Items。
control+5:Show Group Files(當前文件夾內的所有文件),支持即時搜。
control+6:Show Document Items,打開當前文件的函數符號列表(Symbols List),支持即時搜,非常實用。
command+shift+[/]:切換標籤頁
單/雙指左右滑動(control+command+←/→):在單標籤頁打開的多個文件間切換(Go Back/Forward)
command+L :跳轉到指定行。
shift+command+O:Open Quickly,快速全局查找文件、符號,高頻實用!
command+click:點擊跳轉到光標所在的符號定義(jump to definition)。
control+command+J:跳轉到指定符號的定義處或實現處(Go to Declaration/Definition)。有時工程正在Loading、 Indexing或Processing files時,“ command+點擊 ”無法響應,此時可試試 control+command+J。
control+command+↑/↓:切換頭文件/實現文件(switch between a source file (.m,*.mm,*.cc) and the associated header file(.h),Jump to Previous/Next Counterpart)。
在Project Navigator中選中文件右鍵或通過菜單“File->Show in Finder”:在Finder中定位該文件。
command+2可聚焦左側導航欄中的符號導航器。
注意:^ 6只列出當前文件代碼中的符號,而Symbol Navigator是當前工程(Project Scope)的所有符號列表的Hierarchy,符號种類包括Classes/Protocols/Functions/Structs/Unions/Enums/Types/Globals。
編輯器中光標所在符號處,Navigate菜單或右鍵快捷菜單可[Reveal in Symbol Navigator],在符號導航器中定位當前符號,亦可查看當前符號所屬類的層次。
option+command+←/→:折疊當前代碼塊,包括@interface …@end、@implementation …@end
option+ shift +command+←/→:折疊該文件內所有代碼塊(方法/函數: { Methods&Functions })
control+ shift + command+←/→:折疊當前註釋塊( /* Comment Blocks*/)
(shift+)option+command+`:Move Focus to Previous/Next Area.
command+J:焦點切換(Move Focus),可配合鼠標和方向鍵。帶'+'的“Move focus to a new assistant editor”可以快速在輔助編輯窗口中打開頭文件(*.h)/實現文件(*.m,*.mm)。
shift+command+J:在項目導航中定位當前編輯器中打開的文件(Reveal in Project Navigator)。
(shift+)option+command+`:Move Focus to Previous/Next Area.
command+J:焦點切換(Move Focus),可配合鼠標和方向鍵。帶'+'的“Move focus to a new assistant editor”可以快速在輔助編輯窗口中打開頭文件(*.h)/實現文件(*.m,*.mm)。
shift+command+J:在項目導航中定位當前編輯器中打開的文件(Reveal in Project Navigator)。