gpt4 book ai didi

iphone - 如何更改uitableview删除按钮文字

转载 作者:IT王子 更新时间:2023-10-29 07:31:27 25 4
gpt4 key购买 nike

您好,当用户在我的 tableview 中滑动 uitableviewcell 时,我正在尝试更改删除按钮中显示的文本。

我在另一个问题线程中看到了一个例子,上面说要使用这个 tableview delegate

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

我的问题是,我该如何使用这种方法。我不确定如何使用它。

最佳答案

在管理 UITableView 的 Controller 中,您应该实现 UITableviewDelegate 并在 titleForDeleteConfirmationButtonForRowAtIndexPath 方法中返回您想要的方法标题。

例子:

@interface CategoryAddViewController : UITableViewController
@end

@implementation CategoryAddViewController
// ...
-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"Please don't delete me!";
}

@end

让你离开这样的事情:

enter image description here

关于iphone - 如何更改uitableview删除按钮文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7394988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com