iOS编码

来源:互联网 发布:淘宝视频制作软件 编辑:程序博客网 时间:2024/06/06 17:07
1.定义通知名字
类名+xxxx+Notification

在OC中定义在.m中,extern在.h中


2.定义枚举名字
类名+xxxx+style type...


3.注释都在后边//xxxx

4.setter写在后边

5.函数的return如果创建返回的话中间使用一个空格, 其他情况不用加空格


6 命名

@property (nonatomic, strong) UILabel *statusLabel;

@property (nonatomic, strong) CALayer *backgroundLayer;
@property (nonatomic, strong, readonly) NSTimer *fadeOutTimer;

@property (nonatomic, readonly) CGFloat visibleKeyboardHeight;

@property (strong, nonatomic) UIImage *errorImage UI_APPEARANCE_SELECTOR;   
@property (strong, nonatomic) UIView *viewForExtension UI_APPEARANCE_SELECTOR; 

@property (assign, nonatomic) UIOffset offsetFromCenter

@property (assign, nonatomic) SVProgressHUDStyle defaultStyle


方法名: 动词+xxxx

set reset update show pop dismiss push regist move create setup


定义数组,字典集合类型使用xxxs 如HTTPHeaders

定义Block
// 方法参数带Block


7 方法顺序相同功能,参数多的放在下边

+ (void)show ;

+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType;


8 被调用的方法写在下边

updateHUDFrame {

[self updateBlurBounds];

}

updateBlurBounds {

}


9 注释一组的 使用/**/

/* The initializers available to subclasses. See further below for additional init methods.
*/

注释单个的使用

//

定义的枚举, .h中的属性 都要有注释



0 0