IOS UITableView 可移动行实例
来源:互联网 发布:淘宝购物车设计 编辑:程序博客网 时间:2024/05/21 15:00
作者:朱克锋
邮箱:zhukefeng@iboxpay.com
转载请注明出处:http://blog.csdn.net/linux_zkf
效果图如下所示:(注意Toe这一行变化)
移动前 移动后
IOS UITableView 可移动行主要还是代理方法的实现,下面给出主要的代码,其它代码均未给出,都是一些很通用的代码。
和IOS UITableView 可删除行类似,首先要调用下面这行代码
[self.tableViewsetEditing:YES animated:YES];
或者实现其代理方法也是一样的
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editinganimated:animated];
[self.tableViewsetEditing:editing animated:animated];
}
这里是代理方法的实现:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
returnUITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView
canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (void)tableView:(UITableView *)tableView
moveRowAtIndexPath:(NSIndexPath *)fromIndexPath
toIndexPath:(NSIndexPath *)toIndexPath {
NSUInteger fromRow = [fromIndexPath row];
NSUInteger toRow = [toIndexPath row];
id object = [[listobjectAtIndex:fromRow] retain];
[listremoveObjectAtIndex:fromRow];
[list insertObject:objectatIndex:toRow];
[object release];
}
其中list为:
NSMutableArray *list;
- IOS UITableView 可移动行实例
- IOS UITableView 可删除行实例
- IOS UITableView 移动自定义cell
- IOS之UITableView优化-可重用机制
- ios UITableView的移动、添加和删除
- iOS UITableView(六) cell的移动
- iOS开发~UITableView区头跟随移动
- IOS UITableView分组与索引分区实例
- IOS UITableView分组与索引分区实例
- IOS学习笔记-UITableView绑定数据实例
- ios开发系列之UITableView的移动行,编辑行,打开关闭区,刷新表
- iOS 可移动View的实现
- IOS开发(28)UITableView之移动Section和Cell
- 【iOS开发】 UITableView 理解与应用 (增加 删除 移动)
- iOS开发~UITableView 在Plain下区头跟随移动
- IOS UITableView 改变编辑模式下的移动图标
- IOS UITableView编辑模式中,只有移动功能
- NSIndexPath UITableView移动到下一个行
- A/B测试终极指南
- 官方微博运营之道的一点总结
- 通过WriteProcessMemory改写进程的内存
- android Service之二:和Activity交互的本地服务
- 懒人可以用Automator提高工作效率
- IOS UITableView 可移动行实例
- 几个PHP数组函数的理解
- 提升进程权限-OpenProcessToken等函数的用法
- Eclipse Juno下搭建Android开发环境
- 设置脱离状态属性
- 【音乐领域】社交网络不是万能的
- android Service之三:传递基本型数据的远程服务
- 程序员必知8大排序3大查找
- 聚集索引和非聚集索引的区别