Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在编辑时更改iPhone UITableView删除按钮标题_Ios_Iphone_Uitableview - Fatal编程技术网

Ios 如何在编辑时更改iPhone UITableView删除按钮标题

Ios 如何在编辑时更改iPhone UITableView删除按钮标题,ios,iphone,uitableview,Ios,Iphone,Uitableview,在将编辑设置为YES后,我需要更改尝试从UITableView删除行时出现的默认删除按钮的标题。您可以在UITableView委托方法中更改该按钮 - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath 敏捷的 将此方法添加到UITableView委托(可能是视图控制器) 这使按钮显示“擦除”,但您可以使

在将编辑设置为
YES
后,我需要更改尝试从
UITableView
删除行时出现的默认删除按钮的标题。您可以在UITableView委托方法中更改该按钮

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
敏捷的 将此方法添加到
UITableView
委托(可能是视图控制器)

这使按钮显示“擦除”,但您可以使用任何字符串


我更全面的回答是。

Swift 3

差别不大_

func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {
    return "Erase"
}

对于那些已经实现了方法“TitleForDeleteConfirmationButtonFrrowatineXPath”的人,仍然可以看到相同的“删除”文本。


尝试使用自动补全功能从零开始键入方法,因为我复制了某人的方法,它有一点不同的旧符号,没有被调用

你知道我们不知道你在说什么语言/系统/框架/平台吗?你好,伙计!如果你能补充一些你正在做的事情,那就太好了……好的,我已经更新了这个问题,对不起!谢谢,但我确实添加了该方法,并像返回@“Remove”那样返回了NSString;没有发生任何事情,它显示默认标题“删除”@Vladimir,是否可以更改删除按钮的背景?默认显示白色背景的删除按钮。@Hemang,不记得在标准UI中看到白色的“删除”按钮-我想没有打开的APIthat@Vladimir很抱歉这是误会!删除按钮仅为红色,但它查看的背景为白色。按钮位于该视图的中心。这不是我的自定义视图或任何东西,我只是重写了这个方法
-(void)tableView:(UITableView*)tableView committedItingStyle:(UITableViewCellEditingStyle)editingStyle for RowAtIndexPath:(NSIndexPath*)indexPath
,当我在
UITableView
中的任何单元格上滑动时,它会显示“删除”按钮,我想做的是清除该视图的背景!这样,任何单元格上都只显示“删除”按钮。
func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {
    return "Erase"
}