3

「クリア」ボタンが特定のuitableviewcellに表示されないようにして、別のビューセルに表示させる方法があるかどうか知りたいのですが。

ボタンが入ったcustomeuitableviewセルを設定しました。

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{

メソッド..ユーザーがスワイプして削除したときに、いくつかのuitableviewcellの1つに表示されるボタンを停止できるかどうか知りたいですか?

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"Clear";
}

// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) 
    {
        //cell fade - notifies the user that they are edited their cell
        NSArray *rowArray = [NSArray arrayWithObject:indexPath];
        [self.tableView reloadRowsAtIndexPaths:rowArray withRowAnimation:UITableViewRowAnimationFade];

        if (indexPath.row == 0) 
        {

            manufactureSearchObjectString = @"empty";
            [self.tableView reloadData]; //reloads the tabel with new value
            manufactureResultIndexPath = nil; //removes tick from subview

        }
        else if (indexPath.row == 1) 
        {

        }
        else if (indexPath.row == 2) 
        {

        }
        else if (indexPath.row == 3)
        {
            keyTypeSearchObjectString = @"empty";
            [self.tableView reloadData]; //reloads the tabel with new value
            keyTypeResultIndexPath = nil; //removes tick from subview

        }
    }
    else if (indexPath.section == 1) 
    {
        if (indexPath == 0) 
        {
            //can I stop the "clear" button from showing in here?
        }
    }
}

もう少し具体的に言うと、これを止めたいと思っています ここに画像の説明を入力してください

4

1 に答える 1

6

以下の方法を使用してください

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
    {
            if (indexPath.section == 1) 
            {
              if (indexPath.row == 0) 
              {
                 return NO;// you can  stop the "clear" button from showing in here?
              }
              else
                return YES;
            }
          else
            return YES;


    }
于 2011-10-06T04:32:06.317 に答える