zoukankan      html  css  js  c++  java
  • [翻译] RAReorderableLayout

    RAReorderableLayout

     

    A UICollectionView layout which you can move items with drag and drop.

    一种UICollectionView的布局,允许你进行移动和拖拽cell.

    Installation - 安装

    Simply copy RAReorderableLayout.swift into your project.
    Cocoapods has not yet supported swift :(

    你只需要简单的将RAReorderableLayout.swift导到你的工程当中.

    Cocoapods现在还不支持swift :(

    Usage - 使用

    Setup your collection view to use RAReorderableLayout.

    设置好你的collection view,然后你就可以使用RAReorderableLayout.

    You must reorder cells information array in RAReorderableLayoutDelegate protocol to support reordering capability.
    Specifically, please refer to Demo-project.

    你必须重新对你的cell的数据源进行重新排序,请在RAReorderableLayoutDelegate协议中做这件事情,你可以参考Demo来看看怎么使用的.

    Protocol - 协议

    Delegate

    optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, willMoveToIndexPath toIndexPath: NSIndexPath)
    optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, didMoveToIndexPath toIndexPath: NSIndexPath)
    
    optional func collectionView(collectionView: UICollectionView, allowMoveAtIndexPath indexPath: NSIndexPath) -> Bool
    optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, canMoveToIndexPath: NSIndexPath) -> Bool
    
    optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, willBeginDraggingItemAtIndexPath indexPath: NSIndexPath)
    optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, didBeginDraggingItemAtIndexPath indexPath: NSIndexPath)
    optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, willEndDraggingItemToIndexPath indexPath: NSIndexPath)
    optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, didEndDraggingItemToIndexPath indexPath: NSIndexPath)
    

    Datasource

    optional func collectionView(collectionView: UICollectionView, reorderingItemAlphaInSection section: Int) -> CGFloat
    optional func scrollTrigerEdgeInsetsInCollectionView(collectionView: UICollectionView) -> UIEdgeInsets
    optional func scrollTrigerPaddingInCollectionView(collectionView: UICollectionView) -> UIEdgeInsets
    optional func scrollSpeedValueInCollectionView(collectionView: UICollectionView) -> CGFloat
    

    Property - 属性

    var trigerInsets: UIEdgeInsets = UIEdgeInsetsMake(100.0, 100.0, 100.0, 100.0)
    var trigerPadding: UIEdgeInsets = UIEdgeInsetsZero
    var scrollSpeedValue: CGFloat = 10.0
    

    License - 版权

    RAReorderableLayout is available under the MIT license. See the LICENSE file for more info.

  • 相关阅读:
    在线API文档
    用ScriptEngine在java中和javascript交互的例子(JDK6新特性)
    http status 汇总
    post 方式提交XML文件调用接口
    支持DISTINCT的通用分页存储过程(SQL2005)
    Java 延时常见的几种方法
    JSP 页面打印
    javascript利用拷贝的方法实现导出excel(可以导出表格线)
    JVM(十二),垃圾回收面试题
    JVM(十一),垃圾回收之老年代垃圾收集器
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/4238012.html
Copyright © 2011-2022 走看看