- (void)viewDidAppear:(BOOL)animated - (void)viewWillDisappear:(BOOL)animated - (void)viewDidDisappear:(BOOL)animated #pragma mark - Override Methods #pragma mark - Intial Methods #pragma mark - Network Methods #pragma mark - Target Methods #pragma mark - Public Methods #pragma mark - Private Methods #pragma mark - UITableViewDataSource #pragma mark - UITableViewDelegate #pragma mark - Lazy Loads #pragma mark - NSCopying #pragma mark - NSObject Methods ②、不要应用过多的分支,要善于应用return来提前返回缺点的情况,把最精确的情况放到最后返回。
5、大年夜括号写法
对于类的method:左括号另起一行写(遵守苹不雅官方文档)
对于其他应用处景(if,for,while,switch等): 左括号跟在第一行河畔
==例:==
- - (void)sampleMethod
-
- {
-
- BOOL someCondition = YES;
-
- if(someCondition) {
-
- // do something here
-
- }
-
- }
6、property变量
==例:==
- @property (nonatomic, readwrite, strong) UIView *headerView; //注释
对于定义于类头文件的常量,外部可见,则以定义该常量地点类的类名开首,例如EOCViewClassAnimationDuration, 模仿苹不雅风格,在头文件中进行extern声明,在实现文件中定义其值
四、编码规范
1、if语句
①、须列出所有分支(穷举所有的情况),并且每个分支都须给出明白的结不雅。
==推荐如许写:==
- var hintStr;
-
- if (count < 3) {
-
- hintStr = "Good";
-
- } else {
-
- hintStr = "";
-
- }
- var hintStr;
-
- if (count < 3) {
-
- hintStr = "Good";
-
- }
==推荐如许写:==
- if (!user
推荐阅读
揭秘谷歌无人驾驶汽车的秘密世界:多种强大工具首次曝光
《大年夜西洋月刊》本周刊文,揭开了 Alphabet 旗下无人驾驶公司 Waymo 的神秘面纱。在无人驾驶汽车的开辟过程中,Waymo 应用了多种强大年夜的对象,包含模仿对象 Carcraft、机密测试基地>>>详细阅读
本文标题:IOS团队编程规范
地址:http://www.17bianji.com/lsqh/36981.html
1/2 1