iOS常用的代码块整理

有些话、适合烂在心里 提交于 2020-04-25 17:00:35

strong

@property (nonatomic,strong) <#Class#> *<#object#>;

weak

@property (nonatomic,weak) <#Class#> *<#object#>;

copy

@property (nonatomic,copy) NSString *<#string#>;

assign

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

 block

@property (copy, nonatomic) <#returnType#>(^<#blockName#>)(<#arguments#>);

@property (copy, nonatomic) <#returnType#>(^<#blockName#>)(<#type#> <#name#>)

delegate 

@protocol <#delegate#><NSObject>

//方法可实现的

@optional

//方法必须实现

//@required

@end

@property (nonatomic, weak) id <#protocol#> <#delegate#>;

cell    

    static NSString *cid=<#cid#>;

 

    <#Class#> *cell=[tableView dequeueReusableCellWithIdentifier:cid];

    if(cell==nil){

        cell=[[<#Class#> alloc] initWithStyle:UITableViewCellStyleDefault      reuseIdentifier:cid];

    }

    return cell;


//注册Cell


[self.tableView registerNib:[UINib nibWithNibName:<#RegistCell#> bundle:nil] forCellReuseIdentifier:<#RegistCell#>];



 

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!