Xcode代码块

代码片段

Xcode的代码片段(Code Snippets)创建自定义的代码片段,当你重用这些代码片段时,会给你带来很大的方便。

常用代码块

1.copy:

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

2.strong:

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

3.weak:

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

4.assign:

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

5.delegate:

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

6.block:

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

7.mark:

#pragma mark <#boy_mark#>

8.warning:

#warning <#boy_warning#>

9.ReUseCell:

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

11.initObj:

if(self=[super init]){
<#init#>
}
return self;

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(), ^{
<#code to be executed after a specified delay#>
});

16.OnceGCD:

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

你可能感兴趣的:(Xcode代码块)