tableViewCell 多选,索引,汉字排序,左滑操作
来源:互联网 发布:温州网络学堂登录 编辑:程序博客网 时间:2024/06/06 02:38
1.多选的实现,直接设置tableview的两个属性就可以了。
_tableview.allowsMultipleSelectionDuringEditing =YES;
[_tableviewsetEditing:YESanimated:YES];//之所以这样写,没有直接用点语法是因为这样有动画效果。
系统默认选中的时候颜色是蓝色的,修改颜色的话,直接用_tableView.tintColor属性就可以了。
2.左滑操作,是ios8才支持的。直接写在代理方法里面,返回一个UITableViewRowAction的数组。(这个用第三方库也能实现,一个牛逼的左右滑动的第三方https://github.com/MortimerGoro/MGSwipeTableCell)
- (nullableNSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewRowAction *deleteRoWAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"工单"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) { CreatNew_ViewController *creatVC = [[CreatNew_ViewControlleralloc]init]; creatVC.detailDataArray =_dataArray; creatVC.cellPage = indexPath.row; [self.navigationControllerpushViewController:creatVCanimated:YES]; }];//此处是iOS8.0以后苹果最新推出的api,UITableViewRowAction,Style是划出的标签颜色等状态的定义,这里也可自行定义 UITableViewRowAction *editRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"分配"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) { _isAlone =YES; if (!isopen) { buttomView.hidden =NO; [UIViewanimateWithDuration:0.5animations:^{ buttomView.frame =CGRectMake(0,kMainScreenH-44-40-200,kMainScreenW,240); }]; }else { [UIViewanimateWithDuration:0.5animations:^{ buttomView.frame =CGRectMake(0,kMainScreenH-44,kMainScreenW,240); } completion:^(BOOL finished) { buttomView.hidden =YES; }]; } isopen = !isopen; }]; editRowAction.backgroundColor = [UIColorcolorWithRed:0green:124/255.0blue:223/255.0alpha:1];//可以定义RowAction的颜色 return@[deleteRoWAction, editRowAction];//最后返回这俩个RowAction的数组}
3.索引和汉字排序用的人家写好的类,系统自带的类也可以实现。
demo百度云:链接: http://pan.baidu.com/s/1gf0MQp9 密码: 2u34
0 0
- tableViewCell 多选,索引,汉字排序,左滑操作
- Swift tableviewcell左滑删除
- 系统的tableViewCell的左滑实现
- ios——自定义tableviewcell左滑button
- tableViewCell左滑出现删除或其它按钮
- tableViewCell的线左对齐
- OC_UITableviewCell左滑操作
- iOS tableviewCell 下划线左边缘对齐
- 汉字排序
- 汉字排序
- tableViewcell的左滑动显示删除置顶更多的效果
- 解决tableViewCell分割线不到左边界的问题
- UITableViewCell - 右滑、左滑等操作
- SwipeMenuListView,一个简单的左滑操作
- 汉字字索引
- tableviewcell
- tableViewcell
- tableViewCell
- Android应用分类和安全Domain
- YJAutoLayout
- 导入Excel表格数据
- 面向对象的基础和设计模式
- 汇编语言学习第八章-数据处理的两个基本问题
- tableViewCell 多选,索引,汉字排序,左滑操作
- Linux编程之线程基本编程
- 关于IDEA的省电模式
- Android中的Intent和Intent-Filter详解(二)
- Java对象初始化步骤&&子类继承父类后变量与方法调用情况
- Python Logging模块-介绍与使用
- iOS开发 ☞ UIView的alpha、hidden和opaque属性之间的关系和区别
- openldap+phpldapadmin创建ldapserver
- struct union enum