0

したがって、 rightBarButtonItem に関して。私は持っている

self.navigationItem.rightBarButtonItem = self.editButtonItem;

[編集] を押すと、各 TableViewCell の左側にアニメーションと縦縞が表示されます。そのストライプをクリックすると、その tableViewCell の右側に [削除] ボタンが表示されます。

やりたいことは2つ。

  1. その「削除」の名前を「チェック」に変更します
  2. チェックされている場合は、「チェックを外す」と表示され、タップできるはずです。

私はそれについて何か助けていただければ幸いです..

:)

4

2 に答える 2

3

tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:テーブル ビュー デリゲートに実装します。

于 2011-06-02T19:33:39.890 に答える
1

答えの2番目の部分では、これを行いました。

if (editingStyle == UITableViewCellEditingStyleDelete) {

 UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

 if (selectedCell.accessoryType == UITableViewCellAccessoryNone)
 {
     selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
 }
 else 
     if (selectedCell.accessoryType == UITableViewCellAccessoryCheckmark)
     {
         selectedCell.accessoryType = UITableViewCellAccessoryNone;
     }

}   

- (NSString *) tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{

UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

if (selectedCell.accessoryType == UITableViewCellAccessoryNone)
{

    return (@"Check");
}
else 
    if (selectedCell.accessoryType == UITableViewCellAccessoryCheckmark)
    {

        return (@"UnCheck");
    }

}
于 2011-06-02T20:01:00.133 に答える