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 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.
相关文章
|
编译器 Swift iOS开发
Xcode中那些让人焕然一新的特殊注释#pragma mark、TODO、FIXME、MARK
Xcode中那些让人焕然一新的特殊注释#pragma mark、TODO、FIXME、MARK
508 0
Xcode中那些让人焕然一新的特殊注释#pragma mark、TODO、FIXME、MARK
|
iOS开发
xcode中断点的威力,深入使用,老文了。重新mark下
http://www.cocoachina.com/industry/20130701/6514.html
608 0
|
iOS开发
xcode高效开发必备! mark,待实践
http://www.cocoachina.com/ios/20160418/15934.html
720 0
|
5月前
|
jenkins Unix 持续交付
个人记录jenkins编译ios过程 xcode是9.4.1
个人记录jenkins编译ios过程 xcode是9.4.1
76 2
|
5月前
|
Linux 数据安全/隐私保护 iOS开发
如何使用 Xcode 打包导出 IPA 文件并进行 iOS 应用内测,无需支付苹果开发者账号费用?
如何使用 Xcode 打包导出 IPA 文件并进行 iOS 应用内测,无需支付苹果开发者账号费用?
|
2月前
|
iOS开发 MacOS Perl
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘
115 4
|
2月前
|
iOS开发 开发者
解决xcode doesn‘t support iphone’s ios 14.6 (18f72)
解决xcode doesn‘t support iphone’s ios 14.6 (18f72)
187 3
|
2月前
|
缓存 iOS开发
如何在Xcode删除某个版本的IOS模拟器
如何在Xcode删除某个版本的IOS模拟器
359 1
|
2月前
|
iOS开发
mac不通过Xcode直接打开IOS模拟器
mac不通过Xcode直接打开IOS模拟器
174 2