objective-c - IOS滑动删除和多行编辑导致按钮名称设置为默认

标签 objective-c ios uitableview uinavigationcontroller

好吧,我在编辑过程中使用多项选择并同时滑动以删除功能..我想要的是单击选择按钮时,将其标题更改为取消并将颜色设为红色..

而我的情况是标题仍然保留为editdone .我究竟做错了什么?

-(void)setEditing:(BOOL)editing animated:(BOOL)animated {

    if (editing) {
        self.tableView.allowsMultipleSelectionDuringEditing = YES;
        self.editButtonItem.title = @"Cancel";
        self.editButtonItem.tintColor = [UIColor redColor];
     } else {
        self.tableView.allowsMultipleSelectionDuringEditing = NO;
        self.editButtonItem.title = @"Select";
        self.editButtonItem.tintColor = nil;
    }

    [super setEditing:editing animated:animated];
    self.tableView.allowsMultipleSelectionDuringEditing = editing;

}

最佳答案

我不太确定是什么绊倒了。你的问题不够清楚。我会在这里尝试一下,并建议你使用这个委托(delegate)方法。

- (NSString *)tableView:(UITableView *)tableView 
   titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"New name for swipe button";
} 

关于objective-c - IOS滑动删除和多行编辑导致按钮名称设置为默认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11706549/

相关文章:

iphone - 如何在 iphone 中暂停和恢复 NSTimer

iphone - Xcode 4 不在调试区域显示 "EXC_BAD_ACCESS"。为什么不?

ios - 如何在当前位置绘制图钉注释,MapKit,Swift,iOS10

ios - UITableViewCell 中的 UILabel 约束横向变化

ios - UITableViewCell 上的倒数计时器,UITableView 的滚动/滞后问题

ios - 垂直滚动背景-Sprite Kit

objective-c - 自定义字体不起作用

iphone - 一起使用 UINavigationController 和标签栏

ios - 无法将类型 'UITableViewCell' 的值转换为指定类型

ios - 将 MKPlacemark addressDictionary 添加到 UITableViewCell