好久木有写博客了,前面学习的表视图其他内容都木有写,今天就从删除行开始吧,希望自己能够坚持下去。。加油↖(^ω^)↗。。废话少说吧,,,直接上代码:
下面是删除行的核心代码:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
if (editingStyle ==UITableViewCellEditingStyleDelete) {
[aremoveObjectAtIndex:indexPath.row];
[tvdeleteRowsAtIndexPaths:[NSArrayarrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
@interface ViewController :UIViewController<UITableViewDataSource,UITableViewDelegate>{
IBOutletUITableView *tv;
NSMutableArray *a;
NSArray *b;
}