概述
支持通过长按手势开始移动单元格的 tableView。JXMovableCellTableView 添加了 UILongPressGestureRecognizer
,当开始手势时,对被按下的单元格进行快照。然后您可以自定义可移动单元格并开始移动动画。
查看详情!
- 边缘滚动
- 霓虹灯光
- 呼吸
功能
- 只需长按手势即可开始移动单元格。不需要调用系统 api
[tableView setEditing:YES animated:YES];
。 - 可高度自定义正在移动的单元格样式。
- 可高度自定义开始移动单元格动画。
- 支持滑动到屏幕边缘以滚动 tableView。
使用方法
-
canEdgeScroll
是否允许拖动到屏幕边缘,开启边缘滚动。默认为 YES。
-
edgeScrollRange
边缘滚动的触发范围,离边缘越近,滚动速度越快。默认为 150。
-
JXMovableCellTableViewDelegate
/**
* The cell that will start moving the indexPath location
*/
- (void)tableView:(JXMovableCellTableView *)tableView willMoveCellAtIndexPath:(NSIndexPath *)indexPath;
/**
* Move cell `fromIndexPath` to `toIndexPath` completed
*/
- (void)tableView:(JXMovableCellTableView *)tableView didMoveCellFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath;
/**
* Move cell ended
*/
- (void)tableView:(JXMovableCellTableView *)tableView endMoveCellAtIndexPath:(NSIndexPath *)indexPath;
/**
* The user tries to move a cell that is not allowed to move. You can make some prompts to inform the user.
*/
- (void)tableView:(JXMovableCellTableView *)tableView tryMoveUnmovableCellAtIndexPath:(NSIndexPath *)indexPath;
/**
* Customize the screenshot style of the movable cell
*/
- (void)tableView:(JXMovableCellTableView *)tableView customizeMovalbeCell:(UIImageView *)movableCellsnapshot;
/**
* Custom start moving cell animation
*/
- (void)tableView:(JXMovableCellTableView *)tableView customizeStartMovingAnimation:(UIImageView *)movableCellsnapshot fingerPoint:(CGPoint)fingerPoint;
JXMovableCellTableViewDataSource
/**
* Get the data source array of the tableView, each time you start the call to get the latest data source.
* The array in the data source must be a mutable array, otherwise it cannot be exchanged
* The format of the data source:@[@[sectionOneArray].mutableCopy, @[sectionTwoArray].mutableCopy, ....].mutableCopy
* Even if there is only one section, the outermost layer needs to be wrapped in an array, such as:@[@[sectionOneArray].mutableCopy].mutableCopy
*/
- (NSMutableArray *)dataSourceArrayInTableView:(JXMovableCellTableView *)tableView;
安装
手册
下载git仓库,解压zip文件,将JXMovableCellTableView.h和.m拖入您的项目中。
CocoaPods
target '<Your Target Name>' do
pod 'JXMovableCellTableView'
end
在执行“pod install“之前应该运行“pod repo udpate“