是否可以拥有"#pragma mark"层次结构?

pas*_*aya 13 xcode objective-c pragma categories

#pragma mark - Description经常使用Xcode来组织我的方法.但是,我发现有时我需要为我的方法分类和子类别,如下所示:

  • 公共方法

    • 助手方法
      • 一个方法
    • 其他类型的方法
      • anotherMethod
  • 私人方法

    • 某种方法
      • aPrivateMethod

这可能吗?

Joe*_*Joe 26

只需使用-主要部分之前和之后将其包围在行中,排除子部分的短划线,然后方法名称将一如既往地显示.

#pragma mark - Public Methods -
#pragma mark Helper Methods
- (void)aMethod{}
#pragma mark Other Type of Methods
- (void)anotherMethod{}

#pragma mark - Private Methods -
#pragma mark Some Type of Method
- (void)aPrivateMethod{}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述