如何更改uitableview删除按钮文本 [英] How to change uitableview delete button text
问题描述
在用户在我的桌面视图中滑动一个uitableviewcell时,我正在尝试更改删除按钮中显示的文本。
Hi there I am trying to change the text that is showing in the delete button when a user swipes a uitableviewcell inside my tableview.
我已经看到一个例子另外一个问题的线程,说使用这个tableview代理
I have seen an example in another question thread that says to use this tableview delegate
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
我的问题是,如何使用这种方法..我不知道如何
My question is, how do I use this method.. I am not sure how to use this.
推荐答案
在您的控制器中管理 UITableView
UITableviewDelegate
并在 titleForDeleteConfirmationButtonForRowAtIndexPath
方法中返回您想要的方法标题。
In your controller managing the UITableView
you should implement the UITableviewDelegate
and return the title you want for your method inside the titleForDeleteConfirmationButtonForRowAtIndexPath
method.
示例:
@interface CategoryAddViewController : UITableViewController
@end
@implementation CategoryAddViewController
// ...
-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"Please don't delete me!";
}
@end
那个:
这篇关于如何更改uitableview删除按钮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!