TableView 插入表格和删除表格
来源:互联网 发布:淘宝店铺怎么改折扣价 编辑:程序博客网 时间:2024/05/22 01:43
@property NSMutableArray *objects;
//插入数据在第0行
- (void)insertNewObject:(id)sender {
if (!self.objects) {
self.objects = [[NSMutableArrayalloc] init];
}
[self.objectsinsertObject:[NSDatedate] atIndex:0];
NSIndexPath *indexPath = [NSIndexPathindexPathForRow:0inSection:0];
[self.tableViewinsertRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
}
//设置可编辑状态
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
//删除所编辑的单元格
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle ==UITableViewCellEditingStyleDelete) {
[self.objectsremoveObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationFade];
} elseif (editingStyle ==UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
- TableView 插入表格和删除表格
- javascript动态插入和删除表格行
- 插入与删除Excel表格的单元格、行和列
- 创建和删除表格
- js 新增和删除表格
- 编辑表格@tableView实现增加、删除、移动的操作
- 08 TableView 表格视图
- JavaFx TableView表格
- 删除表格
- 删除表格
- 在数据库服务端,添加一个表格,然后在MFC中对数据库表格的数据做插入、删除和修改
- tableView编辑:插入、删除和移动
- 【Richie Zhu】J2EE struts框架查询,删除和插入数据及显示结果到表格
- js动态表格中删除和更新表格中的tr
- javascript插入表格行和列
- javascript插入表格行和列
- Latex插图和插入表格代码模板
- TableView表格索引的建立
- hdoj King's Cake 5640 (模拟)
- Win7下配置Oracle数据源
- Swift - 添加、修改、删除通讯录联系人
- 面向对象基础知识
- 串行通信、并行通信、同步通信、异步通信
- TableView 插入表格和删除表格
- ArrayList、LinkedList和Vector 的区别
- AIX调整swap大小
- rel_exp - IS BOUND
- this指针
- JVM:编译加载与自定义类加载器
- php中使用$_REQUEST需要注意的一个问题
- 追求Masonry
- Python学习笔记——数字