UITableView 编辑
2016-01-26 11:07
399 查看
tableView的编辑:cell的添加、删除。
使⽤场景: 删除⼀个下载好的视频,删除联系⼈; 插⼊⼀条新的聊天记录等
编辑:
1、让tableView处于编辑状态
TableView⽅法
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些⾏可以编辑
TableView DataSource⽅法
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
3、指定tableView编辑的样式(添加、删除)
TableView Delegate⽅法
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
4、编辑完成(先操作数据源,再修改UI)
TableView DataSource⽅法
- (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath: (NSIndexPath *)indexPath;
移动:
1、让tableView处于编辑状态
TableView⽅法
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些⾏可以移动
TableView DataSource⽅法
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath: (NSIndexPath *)indexPath;
3、移动完成
TableView DataSource⽅法
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath: (NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
4、监测移动过程,实现限制跨区移动
TableView⽅法
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
使⽤场景: 删除⼀个下载好的视频,删除联系⼈; 插⼊⼀条新的聊天记录等
编辑:
1、让tableView处于编辑状态
TableView⽅法
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些⾏可以编辑
TableView DataSource⽅法
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
3、指定tableView编辑的样式(添加、删除)
TableView Delegate⽅法
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
4、编辑完成(先操作数据源,再修改UI)
TableView DataSource⽅法
- (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath: (NSIndexPath *)indexPath;
移动:
1、让tableView处于编辑状态
TableView⽅法
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
2、指定tableView哪些⾏可以移动
TableView DataSource⽅法
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath: (NSIndexPath *)indexPath;
3、移动完成
TableView DataSource⽅法
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath: (NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
4、监测移动过程,实现限制跨区移动
TableView⽅法
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
相关文章推荐
- UITableView标示图
- UINavigationControl、界面通信
- UIScrollView、UIPageControl
- UIControl及其子类
- UICollectionView must be initialized with a non-nil layout parameter
- ffmpeg之packet_queue_put解析
- 微信远程控制 arduino+ESP8266wifi模块+Fuhome+继电器模块,安卓远程控制,网页远程控制也可
- Android 教你打造炫酷的ViewPagerIndicator 不仅仅是高仿MIUI
- 仿牛客UI Android版
- 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法
- iOS开发-UITextField(输入框)用法详解
- Ant_build.xml的最完整解释
- ConcurrentLinkedQueue Demo
- UITextView 禁止弹出复制
- 工程中报错或者警告(持续更新)(例如:does not contain bitcode. You must rebuild it with bitcode enabled )
- ConcurrentLinkedQueue使用方法
- UITableView 左滑删除cell
- UINavigationController导航栏按钮设置
- iOS程序启动过程和UIWidnow介绍
- data buffer与CGImage/UIImage互转