**

如何自定义代码块

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

2.右上角方框快速进入

xcode自定义代码块

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#>;

相关文章:

  • 2021-12-31
  • 2022-01-10
  • 2021-08-19
  • 2021-07-01
  • 2021-09-26
  • 2021-09-09
  • 2021-09-07
  • 2021-12-25
猜你喜欢
  • 2021-10-05
  • 2021-08-14
  • 2021-07-03
  • 2021-07-04
  • 2021-11-25
相关资源
相似解决方案