作为mentioned elsewhere , #pragmas inside methods 在 Xcode 4 中不起作用。
在长方法中快速导航到不同部分(例如 switch 语句的特定情况)的好方法是什么?
(我尽量使方法简洁明了,但这是 elsewhere 的主题。)
最佳答案
不确定这是否正是您要找的... 我喜欢做的是像这样简单地使用代码块:
// some code
{
// some code that should stay together
} // [a comment that explains what the code does]
这至少允许您使用 Xcode 的代码折叠:当您折叠两个 { }
之间的 block 时,您会得到 {...}//[您的解释性评论]
限制变量的范围也很好,可以(非常)稍微提高内存效率。
关于iphone - 在 Xcode 4 的方法内部工作的 #pragma 替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8280364/