图像视图正在放大表行删除第二部分



我的问题与这里发布的问题完全相同。

看起来和这个 gif 一模一样。

我不是开始解决问题的方法。 我已经对UICell进行了子类化,并使用了标准的UICell,两者都得到了相同的结果。 我还尝试在编辑模式下将单元格中的图像设置为 nil:cell.imageView.image = nil;

任何想法将不胜感激,如果需要,我可以发布更多代码......

索引路径处行的单元格

(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Item cell func");
    static NSString *CellIdentifier = @"detailCell";
    MCTableViewCell *cell = nil;
    if (cell == nil)
    {
        cell = [[MCTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    // Configure the cell...
    Item * record = [_itemsArray objectAtIndex:indexPath.row];
    cell.imageView.image = [UIImage imageWithData:record.photo];
    cell.textLabel.text = [NSString stringWithFormat:@" %@", record.itemName];
    cell.textLabel.adjustsFontSizeToFitWidth = YES;
    //cell.shouldIndentWhileEditing = NO;
    NSLog(@"Detail Record.Name %@", [_itemsArray objectAtIndex:indexPath.row]);
    return cell;
}

编辑单元格

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{


    NSLog(@"Begin editStyle Func");
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        //UITableViewCellEditingStyleNone
        //    1
        [tableView beginUpdates];
        // Delete the row from the data source
        NSLog(@"after Updates editStyle Func");
        // Delete item from Table
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
        NSLog(@"after Row Animation editStyle Func");

        // Delete Item from Database
        [self.managedObjectContext deleteObject:[self.itemsArray objectAtIndex:indexPath.row]];

        NSError *error;
        if (![self.managedObjectContext save:&error]) {
            NSLog(@"Save: %@", [error localizedDescription]);
        }
        [self showObjects];
        NSLog(@"End of if stmnt");
        //    5
        [tableView endUpdates];
    }

    NSLog(@"End of Function");
}

这个问题似乎发生在ios7中。
在 iOS 8 中,工作正常。所以,这可能是一个错误。

要解决此问题,请将您自己的 UIImageView 添加到单元格并使用它而不是 UITableVewCell 的 imageView。

最新更新