UITableView 删除表格单元写法
来源:互联网 发布:淘宝旺旺名称在哪里看 编辑:程序博客网 时间:2024/06/05 18:39
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSDictionary *section = [data objectAtIndex:indexPath.section];
if (section) {
NSMutableArray *content = [section valueForKey:@"content"];
if (content && indexPath.row < [content count]) {
[content removeObjectAtIndex:indexPath.row];
}
}
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
NSDictionary *section = [data objectAtIndex:indexPath.section];
if (section) {
// Make a local reference to the editing view controller.
EditingViewController *controller = self.editingViewController;
NSMutableArray *content = [section valueForKey:@"content"];
// A "nil" editingItem indicates the editor should create a new item.
controller.editingItem = nil;
// The group to which the new item should be added.
controller.editingContent = content;
controller.sectionName = [section valueForKey:@"name"];
controller.editingTypes = [section valueForKey:@"types"];
[self.navigationController pushViewController:controller animated:YES];
}
}
}
//那一行是要自己添加的 然后把新加那一行的属性设置成UITableViewCellEditingStyleInsert就行了
- UITableView 删除表格单元写法
- UITableView滑动删除表格行(UITableViewCell)
- 表格单元
- javascript js 删除表格的行、单元列
- IOS UITableView使用自适应表格单元(estimatedCellHeight)在调用scroll时的bug
- UITableView选中单元不变蓝色
- IOS UITableView单元点击事件
- IOS - 自定义表格(UITableView)
- IOS - 自定义表格(UITableView)
- UITableView表格拆分
- UITableView/表格视图
- iOS UITableView(表格)
- 表格视图UITableView
- UITableView-表格视图
- UITableView表格数据刷新
- Jquery 表格单元 遍历 计算
- qt翻译--QTextTableCell(表格单元)
- 单元表格图片适应问题
- 设计模式C++实现(4)——单例模式
- android更新应用程序
- VB.net写的调色板
- c++重载运算符
- JAVA中的static
- UITableView 删除表格单元写法
- Strus 2的新表单标志的使用
- No11、求二叉树中节点的最大距离...
- [C++ STL] 一个泛型算法的设计
- Python中的缩进
- Android网络优化之HttpClient
- 常见证书格式和转换
- DIV+CSS基础教程:块状元素和内联元素
- 局部变量使用注意