0

タブバーに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;
}
4

0 に答える 0