我在标签栏中有 2 个 tableViewCell。将值从一个按钮复制到另一个按钮,如果值匹配,则计数器递增,并删除 Cell。在 managedCoreData
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * result = nil;
static NSString * OrederTableViewCell = @"OrderTableViewCell";
result = [tableView dequeueReusableCellWithIdentifier:OrederTableViewCell];
if (result == nil)
{
result = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:OrederTableViewCell];
result.selectionStyle = UITableViewCellSelectionStyleNone;
}
Order * order = [self.orderFRC objectAtIndexPath:indexPath];
result.textLabel.text = order.name;
result.imageView.image = [UIImage imageWithData:[order imageSmall]];
self.count = 1;
if ([order.name characterAtIndex:indexPath.row] == [order.name characterAtIndex:indexPath.row+1])
{
self.count++;
[[self managedObjectContext]deleteObject:order];
}
result.detailTextLabel.text = [NSString stringWithFormat:@"X = %d",self.count];
return result;
}