常用代码块收集整理

收集和整理的常用代码块,仅供自己学习积累使用


1.copy:

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

2.strong:

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

3.weak:

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

4.assign:

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

5.delegate:

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

6.block:

@property(nonatomic,copy) <#Block#><#block#>;

7.mark:

#pragmamark<#mark#>

8.gmark:

#pragmamark- <#gmark#>

9.warning:

#warning<#message#>

10.ReUseCell:

staticNSString*rid=<#rid#>;<#Class#> *cell=[tableView dequeueReusableCellWithIdentifier:rid];if(cell==nil){  cell=[[<#Class#> alloc] initWithStyle:UITableViewCellStyleDefault      reuseIdentifier:rid];}returncell;

11.initObj:

if(self=[superinit]){<#init#>  }returnself;

12.dataFill:

-(void)dataFill:(<#ModelClass#> *)<#model#>{<#code#>  }

13.MainGCD:

dispatch_async(dispatch_get_main_queue(), ^{<#code#>  });

14.GlobalGCD:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{<#code#>});

15.AfterGCD:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(<#delayInSeconds#> * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{<#codeto be executed after a specified delay#>});

16.OnceGCD:

staticdispatch_once_tonceToken;dispatch_once(&onceToken,^{<#code to be executed once#>});

你可能感兴趣的:(常用代码块收集整理)