iOS开发代码块-OC版

iOS开发代码块-OC版

资源分享

自提:

通过网盘分享的文件:CodeSnippets 2.zip

链接: https://pan.baidu.com/s/1Yh8q9PbyeNpuYpasG4IiVg?pwd=dn1i 提取码: dn1i

Xcode中的代码片段默认放在下面的目录中:

~/Library/Developer/Xcode/UserData/CodeSnippets

下载代码块文件解压后 复制到上面的目录下即可。

资源使用详情

  • 注释类代码块

    • ltest
    • lmark
  • gcd

    • 主线程 main -- kmain
    • 子线程 back -- kback
    • 全局队列 -- kglobal
  • 属性

    • kbtn
    • klabel
    • knum
    • kassing
    • kstrong
    • kcopy
    • kblock
  • interface IMP

    • kinterface
    • kimp
  • 初始化

    • kinit
    • kinit...
  • model属性

    • klistclass
    • krename
  • for循环

    • kfor
  • 懒加载

    • klazy
  • masonry

    • kmleft
    • kmwidth
    • kmright...

Xcode自带代码块

1.strong:

objc 复制代码
@property (nonatomic,strong) <#Class#> *<#object#>;

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

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

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

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

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

7.mark:
#pragma mark <#mark#>

8.ReUseCell:

objc 复制代码
static NSString rid=<#rid#>;  
 \<#Class#\> *cell=[tableView dequeueReusableCellWithIdentifier:rid]();  
 if(cell==nil){  

 cell=[\[\<#Class#\> alloc]() initWithStyle:UITableViewCellStyleDefault      reuseIdentifier:rid];  
 }  
 return cell;

9.MainGCD:

objc 复制代码
dispatch_async(dispatch_get_main_queue(), ^{  
\<#code#\>  
  });

10.AfterGCD:

objc 复制代码
 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#\>  
});

11.OnceGCD:

objc 复制代码
 static dispatch_once_t onceToken;  
 dispatch_once(&onceToken, ^{  
\<#code to be executed once#\>  
 });

自定义代码块

  • 选中代码块后鼠标右键:
  • Xcode右上角+ 号:



    User 标签的是用户自定义的代码块,可以手动删除。
相关推荐
2501_915918416 小时前
如何在iPad上找到并打开文件夹的完整指南
android·ios·小程序·uni-app·iphone·webview·ipad
2501_9159184114 小时前
Wireshark、Fiddler、Charles抓包工具详细使用指南
android·ios·小程序·https·uni-app·iphone·webview
TheNextByte11 天前
如何将文件从Android无线传输到 iPad
android·ios·ipad
2501_915106321 天前
如何在iPad上高效管理本地文件的完整指南
android·ios·小程序·uni-app·iphone·webview·ipad
2501_915106321 天前
iOS 成品包加固,在只有 IPA 的情况下,能做那些操作
android·ios·小程序·https·uni-app·iphone·webview
Free Tester1 天前
在iPhone上显示点击屏幕点击的方法
功能测试·ios·iphone
AALoveTouch1 天前
某麦APP抢票技术解析实现
android·ios
2501_915909061 天前
苹果iOS应用上架详细流程与注意事项解析
android·ios·小程序·https·uni-app·iphone·webview
莫桐2 天前
微信小程序-ios环境下webview打开的h5页面replace跳转方式不生效问题
ios·微信小程序·小程序
搜狐技术产品小编20232 天前
iOS OOM治理
macos·ios·objective-c·cocoa