所以关于 rightBarButtonItem 。我有
self.navigationItem.rightBarButtonItem = self.editButtonItem;
当我按下 Edit 时,我会在每个 TableViewCell 的左侧看到动画和垂直条纹。当我单击那个条带时,删除按钮出现在那个 tableViewCell 的右侧。
我想做两件事。
- 将“删除”重命名为“检查”
- 如果它被选中,它应该显示“取消选中”以被点击。
我将不胜感激。
:)
所以关于 rightBarButtonItem 。我有
self.navigationItem.rightBarButtonItem = self.editButtonItem;
当我按下 Edit 时,我会在每个 TableViewCell 的左侧看到动画和垂直条纹。当我单击那个条带时,删除按钮出现在那个 tableViewCell 的右侧。
我想做两件事。
我将不胜感激。
:)
对于答案的第二部分,我这样做了。
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");
}
}