Xcode - Using #pragma mark

不问归期 提交于 2019-12-03 10:58:15

问题


I'm pretty sure this isn't a duplicate. Do you use #pragma mark? I've seen multiple ways, which is correct?

#pragma mark -
#pragma mark === Actions ===
#pragma mark -

#pragma mark -
#pragma mark === Actions ===

#pragma mark - === Actions ===

#pragma mark Actions

What is the way you do it? How do you suggest dividing it up? What do you normally name your sections, for say, a view controller?


回答1:


There is no "Correct" way, it is annotation, so how you use it is a coding style issue.

Having said that, I do:

#pragma mark -
#pragma mark Actions

Because that causes the popup menu in the Xcode editor group the title and the methods inside of the same divider.




回答2:


if use like this

#pragma mark -
#pragma mark Actions

or this

#pragma mark - Actions

xcode will add one separator and bold text line Actions.

BUT if you add one more space after minus - xcode will create two separators one by one...

#pragma mark -SPACEHERE
#pragma mark Actions

:)



来源:https://stackoverflow.com/questions/1230904/xcode-using-pragma-mark

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!