菜鸟教程小白 发表于 2022-12-11 22:07:05

iphone - 折叠部分代码(变量声明和 if block )


                                            <p><p>有没有什么方法可以在 Xcode 4.2 中折叠我的部分代码?我不是要求折叠方法和语句 block ,因为 XCode 已经支持它。 </p>

<p><strong><em>编辑</em></strong>:我有 100 行代码,其中包含变量、数学运算、if 语句、switchblock 等。我想将这些行折叠在一起。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><blockquote>
<p>I have 100 lines of code that contain vars, math operations, if statements, switch blocks, etc ... I want to fold these lines together.</p>
</blockquote>

<p>对于 <code>if</code> 语句和 block ,您可以按照 <a href="https://stackoverflow.com/q/2834605" rel="noreferrer noopener nofollow">How to collapse all methods in XCode?</a> 处的说明进行操作.</p>

<p>如果您使用的是 Objective C,那么您可以使用 <code>#pragma 标记</code> 来检测您的代码,它将是可折叠的。 <code>#pragma mark</code> 很像 Visual Studio <code>#region</code>。见 <a href="https://stackoverflow.com/q/574953" rel="noreferrer noopener nofollow">Can you set code regions in Xcode?</a>了解更多详情。</p></p>
                                   
                                                <p style="font-size: 20px;">关于iphone - 折叠部分代码(变量声明和 ifblock ),我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/9715901/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/9715901/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iphone - 折叠部分代码(变量声明和 if block )