Xcode and #pragma mark
2015-06-26 18:06
375 查看
原帖地址: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 implementation files grow. #pragma mark is simple to use, for example, insert the following to call out initialization code:
Once this is in place, the Functions Menu (in the navigation bar) which shows a list of locations within a source file (e.g. definitions of classes, functions and methods) will display a new marker with the label “Initialization.” The code in line 1 will add a line separator inside the Functions Menu, in this example, with the line appearing above 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.
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.
I’ve started using #pragma mark directives in my code to help with organization as my implementation files grow. #pragma mark is simple to use, for example, insert the following 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. definitions of classes, functions and methods) will display a new marker with the label “Initialization.” The code in line 1 will add a line separator inside the Functions Menu, in this example, with the line appearing above 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.
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.
相关文章推荐
- UVa - 1619 - Feel Good
- Xcode and #pragma mark
- UVa - 1619 - Feel Good
- Codeforces554D:Kyoya and Permutation
- 【密钥算法】Java加密技术(八)---Java证书体系
- 常用的JQuery数字类型验证正则表达式整理
- Xcode and #pragma mark
- sqlite数据库修改及升级
- sqlite数据库修改及升级
- java设计模式之——代理模式
- Fatal signal 11 (SIGSEGV) at 0x000001b4 (code=1), thread 7107
- 【密钥算法】Java加密技术(七)---ECC 数据加密算法
- sqlite数据库修改及升级
- aspcms中if判断语句的运用
- sqlite数据库修改及升级
- oracle 使用 UTL_FILE 导出表数据到txt文件
- redhat6.5静态路由添加问题
- redhat6.5静态路由添加问题
- Typescript的类的使用
- C++对象的内存布局