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

Den*_*er9 5 iphone xcode objective-c pragma xcode4

正如其他地方提到的 ,#pragmas inside方法在Xcode 4中不起作用.

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

(我尝试在可行的地方保持方法清洁和简短,但这是其他地方的主题.)

mru*_*ueg 4

不确定这是否正是您正在寻找的...我喜欢做的就是简单地使用代码块,如下所示:

// some code

{
     // some code that should stay together
} // [a comment that explains what the code does]
Run Code Online (Sandbox Code Playgroud)

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

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