Sportica   Sportica

UITableView 滑动删除

//先要设Cell可编辑
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"xxxxfffwefw");
    return YES;
}


//修改编辑按钮文字
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"删除";
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    /*
    if(indexPath.row ==0)
    {
        [tableView setEditing:YES animated:YES];  //这个是整体出现
    }
     */
    return UITableViewCellEditingStyleDelete;
}


//进入编辑模式,按下出现的编辑按钮后
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"touchIIddddd");
    /*
    if(indexPath ==0)
    {
        [tableView setEditing:NO animated:YES];
    }
     */
}
posted @ 2012-10-31 09:32  qingjoin  阅读(1784)  评论(0编辑  收藏  举报
  Sportica