Xcode7 collectionView的编辑新特性
来源:互联网 发布:电脑设计软件培训 编辑:程序博客网 时间:2024/05/15 20:43
Xcode7更新后可以使用iOS9的系统,其中有一些新的特新,讲一下collectionView的移动过程.collectionView和tableView类似,但是以前并不具备移动功能.现在有了移动功能能更加方法的使用.
设置移动跟tableView的移动类似,只需要几个代理方法就可以实现.
demo在这里(免费的)http://download.csdn.net/detail/reikomiao/9196345
注意:前面的collectionView的基本设置,自定义cell就不赘述了,直接讲移动方法
1.打开编辑状态,下面表示全部都可以编辑
- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath{ return YES;}
2.设置移动
- (void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{ [self.collectionView moveItemAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; //当有数据的时候别忘了刷新数据 [self.collectionView reloadData]}
就这么简单就实现移动了.
移动的时候长按Item想拖哪拖哪.看图
原来是这样
移动一下
一定要是iOS9,Xcode7之前的根本打不出来这些方法.就酱紫,挺好玩的,我能自己拖一天.(:з」∠)
2 0
- Xcode7 collectionView的编辑新特性
- Xcode7新特性
- XCode7 新特性 Bitcode
- iOS-xcode7 新特性相关
- Xcode7新特性之bitcode
- Xcode7 &&iOS9一些新特性 记录
- iOS 9的新特性之一——实现给collectionView上的cell进行重新排序的功能
- Notes 9 编辑模式下超链接的新特性
- xcode7.0新特性之一:真机调试免证书
- xcode7.0-iOS9新特性之二:网络适配
- xcode7.0-iOS9新特性之三:watch
- Xcode7.2:用UIScrollView实现应用新特性(欢迎页)
- ArcGIS 10 新特性之编辑
- delphi6的新特性
- D2005的新特性
- Delphi2005的新特性
- Rose2001的新特性
- Oracle11g的新特性
- [svn] linux命令——svn分支创建、合并
- hdoj 2509 Be the Winner 【博弈】
- C语言面向对象之继承、多态、可变参数、函数指针
- Liunx sed
- CSS背景靠右对齐,并且背景图片右边刘10px
- Xcode7 collectionView的编辑新特性
- 【MySQL】【leetcode】 Rising Temperature解题报告
- Memcached源码分析(线程模型)
- 一款很好用的图片集左右滚动代码,可修改滚动宽度,总宽度,速度等
- Oracle 11g用exp无法导出空表的处理发布方法
- Python及第三方库api查看
- STM32F103UCOSii笔记
- "undefined reference to" 问题解决方法
- LeetCode 15: 3Sum