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) 
     
  • 相关阅读:
    分布式系统简介
    java.lang.Object 之 clone() 深拷贝,浅拷贝
    粉丝裂变活动bug
    遇到的bug
    移动端fixed定位在底部,出现键盘后消失
    窗口关闭,打开新页面,刷新等总结
    input 手机数字键盘
    正则重温(学习笔记)
    input的表单验证(不断更新中~~)
    css 不大常见的属性(不断更新中...)
  • 原文地址:https://www.cnblogs.com/spring286/p/4169284.html
Copyright © 2011-2022 走看看