公告
财富商城
积分规则
提问
发文
2019-01-29 15:36发布
你好瞎i
How to collapse all methods in a class in Xcode?
Collapsing one by one is not an option anymore.
Looks like Ctrl-Command-Up does it (or on the menu: Editor-CodeFolding-FoldMethods/Functions).
Ctrl-Command-Down or Ctrl-U to reverse.
As of Xcode 4 it seems to have changed.
command-alt-shift-left arrow will do the trick...
To fold/unfold current methods or if structures use:
if
Fold: command-alt-left arrow
Unfold: command-alt-right arrow
X-Code 7 onwards
To collapse all method : Shift + Option + Command + Left arrow
To expand all method : Shift + Option + Command + Right arrow
Updates in Xcode 10
Xcode 10 has increased support for code folding, including:
Menubar ► Editor ► Code Folding ► Fold menu item
Look at this snapshot:
Code folding was disabled in Xcode 9 beta 1, which is working now, in Xcode 9 Beta5 according to beta release note: Resolved in Xcode 9 beta 5 – IDE
Here is how:
⌘
Fold
For easy understanding, look at this snapshot:
It's all keyboard short cuts are also working.
Fold ⌥ ⌘ ← option + command + left arrow Unfold ⌥ ⌘ → option + command + right arrow Unfold All ⌥ U option + U Fold Methods & Functions ⌥ ⌘ ↑ option + command + up arrow Unfold Methods & Functions ⌥ ⌘ ↓ option + command + down arrow Fold Comment Blocks ⌃ ⇧ ⌘ ↑ control + shift + command + up Unfold Comment Blocks ⌃ ⇧ ⌘ ↓ control + shift + command + down Focus Follows Selection ⌃ ⌥ ⌘ F control + option + command + F Fold All ⌘ ⌥ ⇧ ← command + option + shift + left Unfold All ⌘ ⌥ ⇧ → command + option + shift + left
Code folding options from Xcode Menu:
Menubar ▶ Editor ▶ Code Folding ▶ "Here is list of code folding options"
Here is ref snapshot:
Same options from Xcode Short-cut list:
Menubar ▶ Xcode ▶ Preferences ▶ Key Bindings ▶ "Here is list of code folding short-keys"
最多设置5个标签!
Looks like Ctrl-Command-Up does it (or on the menu: Editor-CodeFolding-FoldMethods/Functions).
Ctrl-Command-Down or Ctrl-U to reverse.
As of Xcode 4 it seems to have changed.
command-alt-shift-left arrow will do the trick...
To fold/unfold current methods or
if
structures use:Fold: command-alt-left arrow
Unfold: command-alt-right arrow
X-Code 7 onwards
To collapse all method : Shift + Option + Command + Left arrow
To expand all method : Shift + Option + Command + Right arrow
Updates in Xcode 10
Xcode 10 has increased support for code folding, including:
Look at this snapshot:
Code folding was disabled in Xcode 9 beta 1, which is working now, in Xcode 9 Beta5 according to beta release note: Resolved in Xcode 9 beta 5 – IDE
Here is how:
⌘
(command) button in keyboard and move/hover mouse cursor on any (start or end) braces. It will automatically highlight, block area.⌘
(command) button in pressed condition and click on highlighted area. It will enable quick menu popover window withFold
option.Fold
from menu list. It will fold your code and shows 3 dots, folding/covering entire block.⌘
(command) button and click on 3 dots folding a block.For easy understanding, look at this snapshot:
It's all keyboard short cuts are also working.
Code folding options from Xcode Menu:
Here is ref snapshot:
Same options from Xcode Short-cut list: