beike 发表于 2013-2-7 16:47:26

Xcode and #pragma mark iphone 开发中的小技巧

Xcode and #pragma mark

http://macdevelopertips.com/xcode/xcode-and-pragma-mark.html




I’ve started using #pragma mark directives in my code to help with organization as my implementationfiles grow. #pragma mark is simple to use, for example, insert thefollowing to call out initialization code:
 
#pragma mark -#pragma mark Initialization  
 
Once this is in place, the Functions Menu (in the navigation bar)which shows a list of locations within a source file (e.g. definitionsof classes, functions and methods) will display a new marker with thelabel "Initialization." The code in line 1 will add a line separatorinside the Functions Menu, in this example, with the line appearingabove the "Initialization" marker.
The figure that follows shows an example of how you might use #pragma mark to divide up various sections of your code.
http://macdevelopertips.com/wp-content/uploads/2008/09/pragma.png
Two notes:

[*]You cannot have a space after the "-" in the #pragma mark -
[*]If your code does not appear as expected (e.g. the separator does not appear), check that ‘Sort list alphabetically’ is not checked in the Code Sense preference settings.
<!--start wp-tags-to-technorati 0.9 -->
Technorati Tags: #pragma
 
 
 xcode 默认是 按照 字母顺序排列的。
所以看不到上面的效果, 改一下就好了。
这样的话 ,方法提示好多了。
页: [1]
查看完整版本: Xcode and #pragma mark iphone 开发中的小技巧