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

标签 iphone ios uitableview delegates

您好,当用户在我的 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/

相关文章:

ios - Swift:如何显示带有附件 View 的键盘,其中包含成为第一响应者的文本字段?

ios - 当我禁用/启用按钮时, View 如何自行重绘?

ios - UITableViewCell 在用户触摸或点击 Cell 时动画调整大小

iphone - 带有音乐的 iPhone sdk 闹钟应用程序

iphone - 签名仅对临时无效

iphone - 使用 XML 的最佳方式是什么?

ios - 我如何从我的主视图中以模态方式呈现表格 View ?

ios - UICollectionview 滚动时向服务器发送请求?

ios - 如何实现 3D-Touch Peek-and-select?

ios - 设置在 UITableViewCell 中滑动时出现的删除按钮的高度