zoukankan      html  css  js  c++  java
  • Xcode6中使用Code Snippet在Xcode中添加代码段

    通过code snippets,我们可以创建一些可重用的代码块,并且在任何需要的地方很容易的就可以使用这些代码块。这可以节省输入需要的操作和时间。并且,一旦你 学会使用code snippets,会发现你可以创建并扩充自己的code snippet library。
     
    1、创建一个code snippet非常简单。首先,打开Xcode并在utilities panel中选择code snippet library。

    2、将写好的代码直接拖入Code Snippet,注意红框内淡淡的字样

    3、随即会自动弹出提示框,可以更改对应内容,以便使用(Title为code snippets标题;Completion Shortcut为快捷输入)

    任何时候,你都遇到重复输入的相同代码块,都可以考虑将其添加到你的code snippets library中。
     
    下面是我经常使用到的一些snippet:
     
    1     Title: Animation Block 
    2     Completion Shortcut: ab 
    3     Completion Scopes: Function or Method 
    4       
    5     void (^<#Title#>)(void) = ^{ }; 
    1     Title: Animation Completion Block 
    2     Completion Shortcut: acb 
    3     Completion Scopes: Function or Method 
    4       
    5     void (^<#Title#>)(BOOL) = ^(BOOL finished) { }; 
    1     Title: Notification Add 
    2     Completion Shortcut: na 
    3     Completion Scopes: Function or Method 
    4       
    5     [[NSNotificationCenter defaultCenter] addObserver:<#Observer#> selector:<#Selector#> name:<#Name#> object:<#Object#>]; 
    1     Title: Notification Remove 
    2     Completion Shortcut: nr 
    3     Completion Scopes: Function or Method 
    4       
    5     [[NSNotificationCenter defaultCenter] removeObserver:<#Observer#> name:<#Name#> object:<#Object#>]; 
    1     Title: NSLog 
    2     Completion Shortcut: log 
    3     Completion Scopes: Function or Method 
    4       
    5     NSLog(@"<#Log#>"); 
    1     Title: Private Interface 
    2     Completion Shortcut: pi 
    3     Completion Scopes: Top Level 
    4       
    5     @interface <#Title#> () 
    6       
    7     @end 

     1 Title: Property Assign

    2 Completion Shortcut: pa

    3 Completion Scopes: All

    4  @property (assign, nonatomic)  

     1 Title: Property Strong

    2 Completion Shortcut: ps

    3 Completion Scopes: All

    4  @property (strong, nonatomic)  

    1     Title: Property Unsafe Unretained 
    2     Completion Shortcut: pu 
    3     Completion Scopes: All 
    4       
    5     @property (unsafe_unretained, nonatomic) 
     
  • 相关阅读:
    Python3安装和虚拟环境配置
    CentOS中nginx安装部署
    CRM项目的整理---第一篇
    软件代码的发布
    ansible的roles使用
    ansible中的playbook脚本的介绍与使用
    ansible模块的介绍与使用
    Ansible的参数介绍
    ansible的介绍与安装
    linux网络配置,查看IP地址
  • 原文地址:https://www.cnblogs.com/spring286/p/4169284.html
Copyright © 2011-2022 走看看