简体   繁体   English

如何折叠和展开if条件,循环,除了XCode 9中的Methods body之外的“{code}”中的任何其他代码块?

[英]How to fold and unfold a if condition, loops, any other code blocks within “{ code }” other than Methods body in XCode 9?

Recently, I have updated my Xcode from version 8 to version 9. but now I face a weird issue and that is code folding ribbon. 最近,我已将我的Xcode从版本8更新到版本9.但现在我面临一个奇怪的问题,那就是代码折叠功能区。 New version (9) doesn't having such thing in it. 新版本(9)没有这样的东西。 After research a lot I find out the way of folding the code but still it works only for methods(that is press & hold ⌘ key + hover mouse over the opening or closing of methods braces +single tap popup + fold). 经过大量研究后我发现了折叠代码的方法,但它仍然只适用于方法(即按住⌘键+将鼠标悬停在方法大括号的开启或关闭+单击弹出+折叠上)。 but I need to fold every code block that inside the open '{' and close '}' braces ie if, else ,loops, objective c blocks class etc. 但我需要折叠打开'{'和close'}'括号内的每个代码块,即if,else,loops,objective c blocks class等。

I understand you want to fold the {...} clauses in Objective-C, but Xcode 9.2 does not do that. 我知道您想要折叠Objective-C中的{...}子句,但Xcode 9.2不会这样做。

Code folding has undergone some evolution in Xcode 9. Apple completely rewrote the editor in Xcode 9 and code folding was largely broken in Xcode 9.0. 代码折叠在Xcode 9中经历了一些演变。苹果完全重写了Xcode 9中的编辑器,并且代码折叠在Xcode 9.0中大部分都被破坏了。 As of Xcode 9.2 (and Xcode 9.3 beta), it supports folding of entire methods, but does not support code folding of individual Objective-C {...} blocks (eg if , while , etc.). 从Xcode 9.2(和Xcode 9.3 beta)开始,它支持折叠整个方法,但不支持单个Objective-C {...}块的代码折叠(例如ifwhile等)。 For Objective-C, Xcode only does code folding at the method-level. 对于Objective-C,Xcode只在方法级别进行代码折叠。

Xcode does support folding of {...} blocks in Swift code, but not in Objective-C. Xcode支持在Swift代码中折叠{...}块,但不支持在Objective-C中折叠。


FYI, a less cumbersome approach for code folding is to use the keyboard shortcut + + . FYI,一种不那么繁琐的代码折叠方法是使用键盘快捷键 + +

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM