xcode自定义代码块

**

如何自定义代码块

**
1 .选中一行代码右键 crate code snippet

2.右上角方框快速进入

image.png

iOS Xcode自定义代码块迁移

Command + Shift + G. 前往如下路径的文件夹

路径 : ~/Library/Developer/Xcode/UserData/CodeSnippets

把文件夹内部的文件复制, 粘贴到另一台电脑的Xcode同样的文件夹中即可

重启xcode

代码块编写

下面我举个栗子 . 0.O

  • (UITableView *)<#tableview#> {

    if(!<#tableview#>) {

    <#tableview#> = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    <#tableview#>.delegate =self;
    <#tableview#>.dataSource =self;
    [<#tableview#> registerClass:[<#cell#> class] forCellReuseIdentifier:@“cellIdentifier”];} return <#tableview#>;}#pragma mark - tableView delegate- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return <#expression#>}

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return <#expression#>}

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    <#UITableViewCell#> *cell = [tableView dequeueReusableCellWithIdentifier:@“cellIdentifier”];
    return cell;

}

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}
注: <#class#> 即为可以替换的词语.

我再举个栗子

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值