码迷,mamicode.com
首页 > 移动开发 > 详细

APP开发的干货 - 1、使用OC的代码规范

时间:2016-01-21 10:40:08      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

代码规范网址:http://www.csdn.net/article/2015-06-01/2824818-objective-c-style-guide
                         https://github.com/VincentSit/NYTimes-Objective-C-Style-Guide-ZH

1、方法的行数不能大于150,controller的文件代码行数不能大于800

2、#pragma mark 注释

控制器的注释

#pragma mark - --- lift cycle 生命周期 ---

#pragma mark - --- delegate 视图委托 ---

#pragma mark - --- event response 事件相应 ---

#pragma mark - --- private methods 私有方法 ---

#pragma mark - --- getters and setters 属性 ---

视图的注释

#pragma mark - --- init 视图初始化 ---

#pragma mark - --- delegate 视图委托 ---

#pragma mark - --- event response 事件相应 ---

#pragma mark - --- private methods 私有方法 ---

#pragma mark - --- setters 属性 ---

#pragma mark - --- getters 属性 —

3、属性注释的代码段

@property(nullable, nonatomic, readonly)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, readwrite)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, strong)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, copy)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, weak)<#Class#> *<#obj#> ; // <##>

@property(readonly, getter=is<#obj#>)BOOL <#obj#> ; // <##>

@property(null_resettable, nonatomic, strong)<#Class#> *<#obj#> ; // <##>

@property(nonatomic)<#Class#> <#obj#> ; // <##>

@property(nonatomic, assign)<#Class#> <#obj#> ; // <##>

APP开发的干货 - 1、使用OC的代码规范

标签:

原文地址:http://www.cnblogs.com/shentian/p/5147376.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!