@chenbinghua
2015-09-12T17:46:23.000000Z
字数 1357
阅读 2369
iOS技巧
Xcode支持自定义代码段,当输入某个关键字就能提示出某个代码段。
把常用的代码段保存下来,绝对对开发效率有很大的提高。
另外还可以把代码段设置托管到github,方便不同电脑上使用,详细请看唐巧的这篇博文
/** <#注释#> */@property (nonatomic,strong) <#class#> *<#classname#>;
弱引用 UIView等控件,Block
/** <#注释#> */@property (nonatomic,weak) <#class#> *<#classname#>;
/** <#注释#> */@property (nonatomic,copy) <#class#> *<#classname#>;
/** <#注释#> */@property (nonatomic,assign) <#class#> <#classname#>;
NSLog(@"%@",<#object#>);
NSLog(@"%s",__func__);
#pragma mark - <#注释内容#>
NSString *string = @"<#字符串#>";
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
#pragma mark - UITableViewDataSource- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{return <#expression#>;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{static NSString *ID = @"ID";UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];if (cell == nil) {cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];}<#config the cell#>return cell;}
- (instancetype)init{self = [super init];if (self) {<#statements#>}return self;}
<#returnType#>(^<#blockName#>)(<#parameterTypes#>) = ^(<#parameters#>) {<#statements#>};
typedef <#returnType#>(^<#name#>)(<#arguments#>);
