DragAndDropTableView是一个支持拖放重排序表格单元格的UITableView。
除了添加了几项协议外,DragAndDropTableView操作方式与标准的UITableView相同。
@protocol DragAndDropTableViewDataSource <NSObject>
@optional
-(BOOL)canCreateNewSection:(NSInteger)section;
@end
@protocol DragAndDropTableViewDelegate <NSObject>
@optional
-(void)tableView:(DragAndDropTableView *)tableView willBeginDraggingCellAtIndexPath:(NSIndexPath *)indexPath placeholderImageView:(UIImageView *)placeHolderImageView;
-(void)tableView:(DragAndDropTableView *)tableView didEndDraggingCellAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)toIndexPath placeHolderView:(UIImageView *)placeholderImageView;
-(CGFloat)tableView:(DragAndDropTableView *)tableView heightForEmptySection:(int)section;
@end
从图中可以看出所有方法都是可选的。如果您选择实现协议,您的表格所使用的UITableViewDataSource应该实现DragAndDropTableViewDataSource协议,您的UITableViewDelegate应该实现DragAndDropTableViewDelegate协议。
请参阅示例项目以获取进一步的帮助。
如果您正在使用DragAndDropTableView,我很乐意听到您的反馈。在Twitter上发消息给我。
DragAndDropTableView在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。