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) 
     
  • 相关阅读:
    css固定元素位置(fixed)
    【转】php 下载保存文件保存到本地的两种实现方法
    【转】关于URL编码/javascript/js url 编码/url的三个js编码函数
    IE6对png图片的处理
    用phpcms开发模块时中文乱码问题
    【转】MySQL数据类型和常用字段属性总结
    PHPCMS几个有用的全局函数
    PHPCMS系统常量
    PHPCMS系统使用的弹出窗口插件artDialog
    基础知识点(一)
  • 原文地址:https://www.cnblogs.com/spring286/p/4169284.html
Copyright © 2011-2022 走看看