禁用特定单元格

时间:2017-08-21 05:48:56

标签: ios uitableview

我有一个tableview,我想显示UITableViewCellEditingStyleDelete但不是所有这些都显示。根据条件,对于某些单元格,我想显示popover没有删除按钮样式。

在我当前的实现中,当我滑动删除时,我仍然可以看到UITableViewCellEditingStyleDeletepopover

我想知道如果用户在没有popover的情况下从右向左滑动,我怎么才能看到UITableViewCellEditingStyleDelete

self.tableView.allowsMultipleSelectionDuringEditing = NO;


-(void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    if([GlobalFunctions isComboItem:itemId])
    {
        // Show popover --> done
        // hide UITableViewCellEditingStyleDelete -->  ?? dont know   
    }
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        NSString *itemId = [(NSDictionary *)[sharedData.orderItems objectAtIndex:indexPath.row] objectForKey:kItemId];
        [GlobalFunctions deleteItemFromOrder:itemId];
        [self calculate];
    }
}

1 个答案:

答案 0 :(得分:0)

legend: {
  align: 'right',
  verticalAlign: 'top',
  layout: 'vertical',
  x: -50,
  y: 120,
  symbolPadding: 0,
  symbolWidth: 0.1,
  symbolHeight: 0.1,
  symbolRadius: 0,
  useHTML: true,
  symbolWidth: 0,
  labelFormatter: function() {
    if(this.name=="Microsoft Internet Explorer"){
         return '<div style="width:200px;"><span style="float:left; margin-left:10px"><img src = "http://cdn.onlinewebfonts.com/svg/img_508736.svg" width = "40px" height = "40px" style="background-color:' + this.color + ';"></span><span style="float:right;padding:9px">' + this.percentage.toFixed(2) + " " + this.y + '%</span></div>';
    }
   if(this.name=="Chrome"){
   return '<div style="width:200px;"><span style="float:left; margin-left:10px"><img src = "http://cdn.onlinewebfonts.com/svg/img_159842.svg" width = "40px" height = "40px" style="background-color:' + this.color + ';"></span><span style="float:right;padding:9px">' + this.percentage.toFixed(2) + " " + this.y + '%</span></div>';
   }
   if(this.name=="Firefox"){
   return '<div style="width:200px;"><span style="float:left; margin-left:10px"><img src = "http://cdn.onlinewebfonts.com/svg/img_261106.svg" width = "40px" height = "40px" style="background-color:' + this.color + ';"></span><span style="float:right;padding:9px">' + this.percentage.toFixed(2) + " " + this.y + '%</span></div>';
   }

  },
  itemStyle: {
    color: '#ffffff',
    fontWeight: 'bold',
    fontSize: '19px'
  }
},

试试这个