在tableviewcontroller的编辑模式下重命名“删除”按钮

时间:2011-12-19 19:01:59

标签: iphone cocoa-touch uitableview

将编辑模式中的表视图放到其他位置时,我们可以重命名“删除”按钮吗?

4 个答案:

答案 0 :(得分:16)

UITableView委托必须实现:

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

答案 1 :(得分:5)

实施

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

并返回自定义标题以进行删除。

来自UITableViewDelegate docs

答案 2 :(得分:1)

在斯威夫特:

override func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {
        return "Remove"
    }

答案 3 :(得分:0)

代码:

*- (NSString *)tableView:(UITableView *)tableView
titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"Rename"; // or put something else
}*
相关问题