-(void)editBtn(在navigationbar上添加的Edit)
{
NSLog(@"edit");
[changyongTable setEditing:!changyongTable.editing animated:YES];
//[self.navigationItem.leftBarButtonItem setTitle:@"Done"];
if(changyongTable.editing)
{
//[self.navigationItem.leftBarButtonItem setTitle:@"Done"];
[nav.topItem.rightBarButtonItem setTitle:@"Done"];
}
else
{
//[self.navigationItem.leftBarButtonItem setTitle:@"Edit"];
[nav.topItem.rightBarButtonItem setTitle:@"Edit"];
}
}
-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if(editingStyle==UITableViewCellEditingStyleDelete)
{
[changyong2Datasource removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]withRowAnimation:UITableViewRowAnimationFade];
此处没有用到数据永久存储
[self.changyongTable reloadData];
}
}
case 7:
NSLog(@"changyong");
changyong2View=[[ChangyongbView alloc]initWithFrame:CGRectMake(24, 216, 275, 140)];
NSMutableArray *changyongbData=[[NSMutableArray alloc]initWithObjects:@"老婆",@"儿子",@"自助餐",nil];
changyong2View.changyong2Datasource=changyongbData;
[self.view addSubview:changyong2View];
changyong2View.delegate=self;
break;