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

问题描述:

将编辑模式下的表格视图改为别的东西时,我们可以重命名“删除”按钮吗?在tableviewcontroller的编辑模式下重命名“删除”按钮

的UITableView的委托仅仅需要实现:

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

实施

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

,并返回您的自定义标题为删除。

UITableViewDelegate文档

代码:

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

在斯威夫特:

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

'FUNC的tableView(_的tableView:UITableView的,titleForDeleteConfirmationButtonForRowAt indexPath:IndexPath) - >字符串'斯威夫特? 3 – AppreciateIt 2017-08-26 02:44:55