iOS TableView 自带可拖动重排功能
来源:互联网 发布:100m网络下载速度 编辑:程序博客网 时间:2024/05/01 07:18
1.首先设置可以编辑
[self.tableView setEditing:YES animated:YES];
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleInsert;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
//对数据源进行重新排序
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
[models exchangeObjectAtIndex:sourceIndexPath.row withObjectAtIndex:destinationIndexPath.row];
}
//如果是删除和添加的话,不过需要在style中返回要使用的cell的style
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleInsert) {
//添加操作
[models insertObject:@"xxgxgxu" atIndex:indexPath.row];
}
else if (editingStyle == UITableViewCellEditingStyleDelete) {
//删除操作
[models removeObjectAtIndex:indexPath.row];
}
[self.tableView reloadData];
}
- iOS TableView 自带可拖动重排功能
- 可拖动重排GridView
- ios TableView系统自带的编辑cell功能
- iOS tableView 自带的下拉刷新
- iOS自带分享功能
- CodeTyphon32中自带例子源码:可拖动的panel
- tableview 自定义可水平拖动
- iOS自带的二维码扫描功能
- iOS自带的分享功能
- iOS - 系统自带的分享功能
- iOS 自带定位功能CoreLocation
- CodeTyphon32中自带例子源码:可拖动及调整属性的图像对象
- iOS仿网易新闻栏目拖动重排添加删除效果
- ios 类似网易新闻分类中的拖动重排
- iOS-TableView拖动Cell更换次序
- iOS-TableView拖动Cell更换次序
- 【iOS开发】添加系统自带的tableView左滑按钮
- (iOS开发)tableview自带的删除方法(8.0之后适用)
- oracle提示“ORA-01002: 提取违反顺序”
- AR—如何在Unity中使用UserDefineTarget
- MAC上如何进入系统隐藏的目录
- PAT 乙级 1023. 组个最小数
- Struts-default.xml中拦截器个数
- iOS TableView 自带可拖动重排功能
- Confluence5.1 最新版的安装&破解&汉化
- java基础知识
- 多线程编程基础知识
- 231. Power of Two
- 详细解释强力的图片加载框架 Glide的配置(顺便补充下CollapsingToolbarLayout的一些功能)
- Qt构建OpenCV3.1CMake报错Failed to download opencv_ffmpeg.dll
- 67. Add Binary
- public static void main(String args[]){ }中的String args[ ]