首页 > 移动平台 > 详细

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

时间:2016-01-21 10:39:13      阅读:163      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!