美文网首页
#pragma mark - 是一个在类内部组织代码并且帮助你分

#pragma mark - 是一个在类内部组织代码并且帮助你分

作者: 曹波波 | 来源:发表于2017-05-19 15:34 被阅读11次

    pragma mark - 是一个在类内部组织代码并且帮助你分组方法实现的好办法。 我们建议使用 #pragma mark - 来分离:

    不同功能组的方法
    protocols 的实现

    #pragma mark - super (对父类方法的重写)
    - (void)dealloc { /* ... */ }
    - (instancetype)init { /* ... */ }
    
    #pragma mark - View Lifecycle (View 的生命周期)
    
    - (void)viewDidLoad { /* ... */ }
    - (void)viewWillAppear:(BOOL)animated { /* ... */ }
    - (void)didReceiveMemoryWarning { /* ... */ }
    
    #pragma mark - Custom Accessors (自定义访问器)
    
    - (void)setCustomProperty:(id)value { /* ... */ }
    - (id)customProperty { /* ... */ }
    
    #pragma mark - IBActions  
    
    - (IBAction)submitData:(id)sender { /* ... */ }
    
    #pragma mark - Public
    
    - (void)publicMethod { /* ... */ }
    
    #pragma mark - Private
    
    - (void)zoc_privateMethod { /* ... */ }
    
    #pragma mark - UITableViewDataSource
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { /* ... */ }
    
    #pragma mark - ZOCSuperclass
    
    // ... 重载来自 ZOCSuperclass 的方法
    
    #pragma mark - NSObject
    
    - (NSString *)description { /* ... */ }
    
    

    相关文章

      网友评论

          本文标题:#pragma mark - 是一个在类内部组织代码并且帮助你分

          本文链接:https://www.haomeiwen.com/subject/zxmyxxtx.html