UIday1001:UITableView 2 编辑(添加、删除)、移动、UITableViewController
来源:互联网 发布:手机虚拟机安装windows 编辑:程序博客网 时间:2024/06/05 06:20
一、 tableView 编辑
tableView 的编辑:cell的添加、删除。
使⽤用场景:
删除⼀个下载好的视频,删除联系⼈;
插⼊一条新的聊天记录等
1、让tableView处于编辑状态
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些⾏可以编辑
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
3、指定tableView编辑的样式(添加、删除)
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
4、编辑完成(先操作数据源,再修改UI)
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;
⼆、 tableView 移动
1、让tableView处于编辑状态
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些行可以移动
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
3、移动完成
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
监测移动过程,实现限制跨区移动
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath;
三、 UITableViewController
UITableViewController继承⾃UIViewController,⾃带⼀个tableView
self.view不是UIView而是UITableView
datasource和delegate 默认都是self(UITableViewController)
开发中只需要建立 UITableViewController ⼦类
⽆论编辑还是移动,都先让 tableView 进⼊编辑状态。 编辑结束或者移动结束, 要先修改数组或字典中的数据,再更改UI。
UITableViewController 是封装好了各种 delegate 和 datasource ,能提⾼我们开发速度。
tableView 的编辑:cell的添加、删除。
使⽤用场景:
删除⼀个下载好的视频,删除联系⼈;
插⼊一条新的聊天记录等
1、让tableView处于编辑状态
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些⾏可以编辑
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
3、指定tableView编辑的样式(添加、删除)
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
4、编辑完成(先操作数据源,再修改UI)
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;
⼆、 tableView 移动
1、让tableView处于编辑状态
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些行可以移动
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
3、移动完成
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
监测移动过程,实现限制跨区移动
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath;
三、 UITableViewController
UITableViewController继承⾃UIViewController,⾃带⼀个tableView
self.view不是UIView而是UITableView
datasource和delegate 默认都是self(UITableViewController)
开发中只需要建立 UITableViewController ⼦类
⽆论编辑还是移动,都先让 tableView 进⼊编辑状态。 编辑结束或者移动结束, 要先修改数组或字典中的数据,再更改UI。
UITableViewController 是封装好了各种 delegate 和 datasource ,能提⾼我们开发速度。
0 0
- UIday1001:UITableView 2 编辑(添加、删除)、移动、UITableViewController
- 12 UITableView编辑和移动 、UITableViewController、(+UIDatePicker)
- UITableView 编辑状态(删除、添加、移动)
- UITableView的编辑操作(移动&添加&删除-单选删除,或多选删除)
- UITableView 添加,删除,编辑
- UITableViewController 编辑功能中的,添加,删除,修改
- UITableViewController 编辑功能中的,添加,删除,修改
- UITableViewController 编辑功能中的,添加,删除,修改
- UITableView实现删除移动编辑的样式
- UItableView中编辑,删除,移动学习笔记
- UITableView-编辑模式(多选移动删除)
- 28.UITableView表视图第三章(移动和编辑删除和添加)
- UI一揽子计划 10 (UITableView 中cell 的编辑, 增加, 删除、UITableViewController 、)
- UITableView 编辑(增删移动)
- ios UITableView的移动、添加和删除
- UIday1002:UITableView 2 用UITableView实现通讯录cell简单的数据移动、删除、添加功能
- 【精】表格(UITableView)总结(4):编辑(增加、删除、移动)
- UITableView(二编辑移动)
- Java多线程之五线程池
- UICollectionView用法总结
- Java多线程之六并发容器
- 1081. Rational Sum (20)
- Java CMS垃圾收集器几个过程
- UIday1001:UITableView 2 编辑(添加、删除)、移动、UITableViewController
- hdoj 1507 Uncle Tom's Inherited Land* 【二分图 二维坐标划分奇偶集构图 求最大匹配】
- android菜鸟进阶之路——应用程序里嵌入网页
- Android获取内存信息
- 第二周项目—C/C++语言中函数参数传递的三种方式
- Good laravel 4 library
- Contiki 调度内核不完全介绍
- Android gradle 编译 MultiDex
- 1082. Read Number in Chinese (25)