项目约定

开发框架

项目以MVC框架开发

注意:
1: push必须在vc中调用
2: 按钮事件需传递到vc中处理
3: import尽量在.m
4: delegate协议声明尽量在.m e.g

config

第三方库配置

[[UIApplication sharedAnimated]configTABAnimated];

颜色

1: UIColor分类

+ (UIColor*)ug_R:(CGFloat)r G:(CGFloat)g B:(CGFloat)b A:(CGFloat)a;

+ (UIColor *)ug_hexString:(NSString *)color;

+ (UIColor*)ug_random;

2:常用颜色
#defind

字体+间距

#defind

日志

DDLogVerbose(@"Verbose");
DDLogDebug(@"Debug");
DDLogInfo(@"Info");
DDLogWarn(@"Warn");
DDLogError(@"Error");

弹框

以view调用

+(void) ug_msg:(NSString*)msg;
-(void) ug_msg:(NSString*)msg;

+(void) ug_alert:(NSString*)msg;
-(void) ug_alert:(NSString*)msg;

+(void) ug_starloading;
-(void) ug_msg starloading;

+(void) ug_stoploading;
-(void) ug_stoploading;

封装

1: UIView封装
简单的view集合,对外暴露view集合

UserinfoView
- headImgview;  //头像
- starBtn;  //点赞btn
- nameLab;  //名称lab

userinfoVC
@property(strong, nonnull)   UserinfoView *userinfoview;

-(void)configUI{
    self.userinfoview = [UserinfoView new];
    [_userinfoview. headImgview setimage:...];
}

-(void)viewLayoutMarginsDidChange{
    [super viewLayoutMarginsDidChange];
    [_userinfoview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
}

http请求

管理器:Httpmanage

1:定义核心请求内容
2:暴露 head配置,POS,GET,UPDATE,DOWNLOAD方法,
3:结果以block(NSDictionary,NSError)方式返回,如果有error返回error,提示error.dom ,无error返回NSDictionary,在对应的vc中解析

api 分类

+(void)userlist:(NSString*)page finish:void(^fineshBlock)(NSDic*datadic, NSError*error){
    NSString *url = @"http:www.baidu.com";
    NSDictionary *parm = @{@"page":page};
    Httpmanage.post:url parm:pram  head:head fineshBlock: fineshBlock];
}

你可能感兴趣的:(项目约定)