好久木有寫博客了,前面學習的表視圖其他內容都木有寫,今天就從刪除行開始吧,希望自己能夠堅持下去。。加油↖(^ω^)↗。。廢話少說吧,,,直接上代碼:
下面是刪除行的核心代碼:
- (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;
}