Xcode是否支持区域? [英] Does Xcode support regions?

查看:94
本文介绍了Xcode是否支持区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode是否支持类似于Visual Studio样式的#region指令以进行任意代码折叠?

Does Xcode support anything akin to Visual Studio style #region directives for arbitrary code folding?

推荐答案

不,您只能在Xcode中定义的各种作用域上折叠代码.

No, you can only fold code on various defined scoping levels in Xcode.

不过,您可以使用一些小技巧来简化通过功能菜单的导航.

You can use little tricks to make navigating via the function menu easier, though.

#pragma mark

允许您创建一个分组,标记后的标签将显示在功能菜单中.如果标签是连字符,则在功能菜单中插入一个分隔符.

Allows you to create a grouping where the label following mark will show up in the function menu. If the label is a hyphen, a separator is inserted into the function menu.

此外,功能菜单中还会显示以下注释标签:

Also, the following labels in comments will show up in the function menu:

// MARK:
// TODO:
// FIXME:
// !!!:
// ???:

显然,由于#pragma标记不是真正可移植的,因此,如果您要构建可移植的应用程序并且需要它与不仅仅忽略它不理解的#pragma指令的编译器一起使用,则使用注释样式标记是一个不错的选择.

Obviously since #pragma mark is not really portable, if you're building a portable application and need it to work with a compiler that doesn't just ignore #pragma directives that it doesn't understand, the comment-style mark is a decent alternative.

这篇关于Xcode是否支持区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆