#pragma的替代品,适用于Xcode 4中的方法

时间:2011-11-26 17:52:04

标签: iphone objective-c xcode xcode4 pragma

作为mentioned elsewhere,方法中的#pragmas在Xcode 4中不起作用。

在long方法中快速导航到不同部分的好方法是什么,例如切换语句的特定情况?

(我尽量保持方法的清洁和简短,但这是elsewhere的主题。)

1 个答案:

答案 0 :(得分:4)

不确定这是否正是您正在寻找的...... 我喜欢做的是简单地使用这样的代码块:

// some code

{
     // some code that should stay together
} // [a comment that explains what the code does]

这至少允许你使用Xcode的代码折叠:当你在两个{ }之间的块中折叠时,你得到{...} // [your explanatory comment]

限制变量的范围也很棒,并且可以(非常)略微提高内存效率。